I need to trim dynamic text to cut 2 lines from it (teaser). The problem is that the number of lines that accept the displayed line in a div depends on the characters used (for example, "w" and "i" do not have the same width), browser and OS (the font on the Mac is not exactly the same font on Windows).
Is there a way in javascript to trim text that will be longer than the x lines in the div (knowing that the length of the div is fixed)?
Thanks.
source share