DEV Community

loading...

Discussion on: Add ... when text is too long

Collapse
ichik profile image
vadim • Edited

Unless you need to support IE you can just do this:

display: -webkit-box;
-webkit-line-clamp: $lines;
-webkit-box-orient: vertical;
Enter fullscreen mode Exit fullscreen mode
Collapse
sasscrafter profile image
Dima Prohorenko Author

Cool didn’t know about this. What’s the difference, your solution is just 1 line shorter?)

Collapse
ichik profile image
vadim

Better semantics, and will also work if you want more than one line of text to be clamped.

Thread Thread
sasscrafter profile image
Dima Prohorenko Author

Ok thanks 😉

Forem Open with the Forem app