How to fold a paragraph and replace the rest of the content with ‘…’?

Well, I have content within a paragraph, maybe like this:

<div style="width:30px">
  <p>12345678901234567890abcdefghijklmnopqrstuvwxyzIlovePaulinaVega</p>
</div>

We all know that the content will be divided into many lines because of its parent’s width, but I just want to keep the top 2 lines, the rest is replaced with’…’. I am wondering how to accomplish it ?Tell me please.


Source: jquery

Leave a Reply