-2

If you looks at youtube's main page, you can see that the end of every title is replaced by "..." if it haven't finished. I want to do the same.

for example: the sentence "I love going out every day" in a short div might changed to "I love going out every d..." If the user click "ctrl" + "+" it might change to "I love going out eve...".

How do i archive that?

Eran Shmuel
  • 149
  • 2
  • 15

1 Answers1

1

You can do that with the CSS text-overflow rule.

.titles {
    text-overflow: ellipsis;
}

(You'll probably want to set white-space: nowrap to achieve the full effect)

Read more at MDN

SomeKittens
  • 38,868
  • 19
  • 114
  • 143