Single line:
div {
/* 单行溢出隐藏 */
width: 150px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
Multi-line:
div {
/* 多行溢出隐藏 */
width: 150px;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 3;
overflow: hidden;
}
Note:
-webkit-line-clamp
used to limit the number of lines of text displayed in a block element. In order to achieve this effect, it needs to combine other WebKit properties. Common binding properties:display: -webkit-box
; Attributes that must be combined to display the object as an elastic box model.-webkit-box-orient
must be combined with attributes to set or retrieve the arrangement of the child elements of the telescopic box object.
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。