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