How visually a long line?

I would like to know how long the line appears when it appears on the screen. We do not use a fixed-width font, therefore:

"Our mother tummy makes dummy noises."

much wider:

"Lilly Leadbetter lives life leisurely."

Is there a way to tell how long something comes from the characters? I don’t need the absolute accuracy of the pixel long enough for the ellipse to be somewhere in the right place. CSS overflow will not help, because I cannot attach an ellipse after CSS has determined how long it will be.

+3
source share
4 answers

fsb, , . . , , .

, ThreeDots, jQuery.

+2

, , . , , <span>, ( JavaScript) , , .

jQuery, ​​, .

+7

, , . , - , .

-, , . GD ( - ), , , , ?

javascript ( - ) , DOM ( ).

One solution, although perhaps very difficult psychologically, is to realize that rendering web pages is not typography. You have no control. You do your best, accept the limitations, and move on to the next problem. Technically simple, but maybe hard to accept.

+2
source

You can use a helper function truncate. Even if you know about the length of visibility, you cannot optimize it for all sizes of browsers / browsers.

0
source

Source: https://habr.com/ru/post/1726826/


All Articles