Trim overflow text in css?
16,720
Solution 1
Maybe you can try
text-overflow:ellipsis;
http://davidwalsh.name/css-ellipsis
Solution 2
Yes, that is possible to achieve solely by CSS.
See my Example on jsFiddle
Key for achieving the effect is to use a combination of the following CSS-properties:
width: [x]px
overflow: hidden
white-space: nowrap
text-overflow: ellipsis
The width is neccessary to use overflow. Overflow is needed for text-overflow and white-space is needed to prevent breaks and to assure that the whole text is in one line.
Author by
001
Only questions with complete answers are accepted as solutions.
Updated on June 24, 2022Comments
-
001 almost 2 years
Is it possible to trim the ending of the text?
INPUT
this is an extremely very long text
RESULT
this is an ...