CSS text overflow

I am writing a dynamic application, and one problem is that I have the text contained inside the div and the browsers behave funny when the size of the div is too small to contain the text.

Is there a way to make text “trim” in CSS? Any text that does not fit is deleted.

+3
source share
4 answers

Use overflow: hidden

+5
source

Have you tried overflow: hidden;?

+3
source

, CSS- ( ). CSS3, text-overflow: ellipsis, '& hellip;' . , Firefox , . , Firefox, .

:
W3C ( )

Firefox

+1
source
 /*ellipsis stuff*/
    white-space: nowrap;
    overflow: hidden;
    text-transform: none;
    text-overflow: ellipsis;  /* IE 6+, FF 7+, Op 11+, Saf 1.3+, Chr 1+*/
    -o-text-overflow: ellipsis;  /* for Opera 9 & 10 */
    -ms-text-overflow: ellipsis; /*IE 8*/

obs: also set the width to your preferred size

+1
source

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


All Articles