CSS line clamp

Need to limit the amount of text visible in your web design? Use these four lines of CSS to limit the contents of a block container to the set number of lines.

.description {
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 5;
overflow: hidden;

How to use

Add the above CSS to the text you want to shorten to a specific number of lines. Change the -webkit-line-clamp value to the number of lines you want to show.