1)已知文字父级元素p的高度,比如500px;
2)已知字体大小:font-size:28px;
如何算出需要显示多少行?
知道多少行后,如何实现指定这些行后内容未显示完就用省略号...代替?
PHPz2017-04-17 11:34:50
.xxx {
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 3;
line-height: 20px;
max-height: 60px;
}
伊谢尔伦2017-04-17 11:34:50
Limit the maximum number of displayed lines. If it exceeds the limit, use... instead of `!
PHP中文网2017-04-17 11:34:50
How many lines is how many lines... It is not difficult to control css with 1 line, but more is unclear
巴扎黑2017-04-17 11:34:50
Portal http://stackoverflow.com/questions/3922739/limit-text-length-to-n-line...
PHP中文网2017-04-17 11:34:50
There are not many lines, only the height. When the content exceeds the specified height, use js
to truncate it~
ringa_lee2017-04-17 11:34:50
The number of rows cannot be controlled. Use height instead and estimate your number of rows.