Trim a text and show an ellipsis instead full text with CSS

In case we have a div element with fixed width, for example 100 pixels, and we only want to show an excerpt of text instead showing full text, let’s use this simple css trick.

For example, look at this before and after image:

And here is a few lines of css codes we can use:

Do you like this post? Consider a donation 😀

Published by

Habibie

Habibie is an Indonesian freelance frontend-backend web programmer and cross platform mobile app developer. He's also good at graphics design, video editing, visual effects and animation.

Leave a Reply

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