admin管理员组文章数量:1315118
I need to have a box (div) with some text over multiple lines, and this box needs to have a fixed width and a fixed max height.
I'm using the overflow: hidden;
Now my problem is that if the last line doesn't fit in the div max height it will get cut (cutting just half of the line for example). What I want to do in this case is not to show the last line, and display ellipsis in the last one
My problem is not inserting ellipsis in a single text line (using the white-space: nowrap
property), the main problem is that the text gets cutted in the last line, ellipsis is not an issue because in last case I can use jQuery to insert it
I need to have a box (div) with some text over multiple lines, and this box needs to have a fixed width and a fixed max height.
I'm using the overflow: hidden;
Now my problem is that if the last line doesn't fit in the div max height it will get cut (cutting just half of the line for example). What I want to do in this case is not to show the last line, and display ellipsis in the last one
My problem is not inserting ellipsis in a single text line (using the white-space: nowrap
property), the main problem is that the text gets cutted in the last line, ellipsis is not an issue because in last case I can use jQuery to insert it
- Try this link:stackoverflow./questions/3067696/… – dreamerkumar Commented Oct 12, 2012 at 14:26
1 Answer
Reset to default 6Add
text-overflow: ellipsis;
to the Div
EDIT: ok, not possible for now, not in a standardized way.
BUT, it's possible to achieve it with experimental webkit features (see this topic), or to do it with JS through the solution written by this guy, and hosted on github.
本文标签: javascriptText wrap with fixed maxheightStack Overflow
版权声明:本文标题:javascript - Text wrap with fixed max-height - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741963561a2407419.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论