3

I have a few div elements, I want to hide overflow characters when div resizing like this

enter image description here to this enter image description here how to do this every time i resize page.

Can i do it from CSS?

Thusitha Wickramasinghe
  • 1,063
  • 2
  • 15
  • 30

1 Answers1

4

Just add the following css to the div which contains the text:

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

This will simply add the three dots at the end of the line whenever the text is longer than the div.

Note: This works only for a 1 line text.

Asaf David
  • 3,167
  • 2
  • 22
  • 38