Wrap a text within only two lines inside div

前端 未结 11 732

I want to wrap a text within only two lines inside div of specific width. If text goes beyond the length of two lines then I want to show elipses. Is there a way to do that

11条回答
  •  离开以前
    2020-12-04 09:24

    Try something like this: http://jsfiddle.net/6jdj3pcL/1/

    Here is a paragraph with a lot of text ...

    p { line-height: 1.5em; height: 3em; overflow: hidden; width: 300px; } p::before { content: '...'; float: right; margin-top: 1.5em; }

提交回复
热议问题