Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to use text-overflow:ellipsis on multiline text?

Tags:

html

css

I have a <p> tag with a specific width and height.

I want to use text-overflow:ellipsis to get ... if the text in the tag is too long.

Is this possible to solve with css on multiline text?

like image 744
Johan Avatar asked Jul 04 '11 13:07

Johan


People also ask

Can I use text-overflow ellipsis?

The text-overflow CSS property sets how hidden overflow content is signaled to users. It can be clipped, display an ellipsis (' … '), or display a custom string.

How do I display text on multiple lines?

Yes, you can put them all in separate paragraphs, using the <p></p> tag or you can separate them via a <br> tag at every line.

How do I force text-overflow ellipsis?

To force overflow to occur and ellipses to be applied, the author must apply the nowrap value to the white-space property on the element, or wrap the content in a <NOBR> tag.


1 Answers

Googling doesn't reveal anything even remotely promising, so I'm going to say that it's not possible.

I did find text-overflow: -o-ellipsis-lastline, but it only works in Opera: http://people.opera.com/dstorey/text/text-overflow.html (mirror: http://jsbin.com/exugux/)

There's also a similar WebKit-only solution: http://dropshado.ws/post/1015351370/webkit-line-clamp

like image 70
thirtydot Avatar answered Sep 19 '22 16:09

thirtydot