Skip to content
Milind Soorya
Go back

Add ellipses to overflowing text and truncate the text using CSS

If you don’t want text to wrap and occupy multiple lines, you can easily add ellipses to overflowing text and truncate the text into a single line. this is how to do it.

Add the following to the div containing the text.

div {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

Share this post on:

Previous Post
How to install jupyter notebook on ubuntu 20.04/18.04 using python 3 and virtualenv
Next Post
Using Redis to make your website 30-40% faster