开发者

Show only 2 rows preview of div content

How to show only two rows preview of div content?

If I use like substring in C# would cause 开发者_JAVA技巧HTML tag error issue.

so, I wonder if I could do this?


you could do this from css to the parent element

overflow: hidden;
height: necessary_height_to_show_only_2_rows;
width: 100%;
display: block;


If i understood you correctly, you have this:

<div>
    line-one
    line-two
    line-three
</div>

you can use the following css to hide the last line:

div {
    line-height: 14px; #for example.
    height: 28px; #double the line-height.
    overflow: hidden;
}

if you want to add padding/extra space - create a wrapper div.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜