CSS technique to abbreviate text that does not fit on a single line with a three-pointed leader

In web design, one method for displaying text that does not fit on a single line due to space limitations in an easy-to-read manner is to automatically abbreviate the text using the three-point leader “…”. This method is especially useful in situations where space is limited, such as in responsive or card-type designs.

To apply this effect, use the following CSS

overflow: hidden; 
text-overflow: ellipsis; 
white-space: nowrap;

overflow: hidden; ” hides the content of an element if it extends outside the box.
text-overflow: ellipsis; ” abbreviates with a three-point leader when text extends beyond the element’s box.
white-space: nowrap; ” forces text to fit on a single line.

This combination can be used to achieve the effect that text exceeding one line is automatically abbreviated with a “…” at the end.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top