Vertical Text Clampin with CSS

twitter logo Updated on ・1 min read

Yeah, its easy clamping text horizontally with CSS and I often have found the people use hundreds of lines of js code for ending the text in X number of line vertically with ... .But you might not have to do that at all you can use this following CSS snippet to clamp texts vertically in x number of lines.

.vertical-clamp {
display: -webkit-box;
-webkit-line-clamp: 4; /* Only Show Four Lines */
-webkit-box-orient: vertical;

twitter logo DISCUSS
Classic DEV Post from Sep 2

What do you think of minimalist UI?

RaZaan Shrestha profile image
Frontend Dev