How to limit the amount of rows in a text with JavaScript / jQuery?

-2

I want to limit the number of characters in a paragraph by up to two lines, not necessarily an absolute number of characters, since the amount in each line can vary as the width of the element changes ... Is there any way to do this with JavaScript / jQuery?

    
asked by anonymous 02.09.2018 / 06:59

1 answer

0

With the responsive width there is no way, as you yourself said: "The number of characters in each line changes according to the width" .

What you can do is set fixed width for the element that is the paragraph and then set the maximum characters, and when it is other widths that must be smaller or larger than that, you can use Media Query in if you use javascript, and in the same if(width < X){} you also change the element character limits.

    
02.09.2018 / 09:19