仅显示段落的前两行 [英] Show only first two rows from a paragraph
本文介绍了仅显示段落的前两行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要在两行上显示一些文本,如果文本太长,则添加一些"...".
I need to display some text on two lines, and add some "..." if the text is too long.
示例:
This is some long text and we need to show it on only two lines.
=>
This is some long
text and we need ...
必须使用<p>
标记显示文本.
The text must be displayed with a <p>
tag.
推荐答案
text-overflow works on some browsers -> http://www.quirksmode.org/css/textoverflow.html
或
此处的最佳答案-> 插入省略号(... )如果内容太宽
Excellent answer here -> Insert ellipsis (...) into HTML tag if content too wide
或
仅限制显示两行-> jTruncate jQuery插件效果很好
To just limit the showing of 2 lines -> jTruncate jQuery plugin works well
这篇关于仅显示段落的前两行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文