Limit text length to n lines using CSS

There’s a way to do it using unofficial line-clamp syntax, and starting with Firefox 68 it works in all major browsers. body { margin: 20px; } .text { overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; /* number of lines to show */ line-clamp: 2; -webkit-box-orient: vertical; } <div class=”text”> Lorem ipsum dolor sit amet, … Read more

What does the Ellipsis object do?

This came up in another question recently. I’ll elaborate on my answer from there: Ellipsis is an object that can appear in slice notation. For example: myList[1:2, …, 0] Its interpretation is purely up to whatever implements the __getitem__ function and sees Ellipsis objects there, but its main (and intended) use is in the numpy … Read more

Applying an ellipsis to multiline text [duplicate]

Just increase the -webkit-line-clamp: 4; to increase the number of lines p { display: -webkit-box; max-width: 200px; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; } <p>Lorem ipsum dolor sit amet, novum menandri adversarium ad vim, ad his persius nostrud conclusionemque. Ne qui atomorum pericula honestatis. Te usu quaeque detracto, idque nulla pro ne, ponderum invidunt eu … Read more