marcias
marcias

Reputation: 236

Work with the visible text of a <p> with hidden overflow

actually I think my question will be unanswered, but I give it a try... Is there any way, to work with only the visible part of the text inside an overfloating div?

I mean, there is a div with 300px height, and inside of it a dynamic text can be about 500-600px height. I created a toogle to show all. In the 'collapsed' state, I want to put '...' at the end of the last visible line. Does anybody think this is possible?

Upvotes: 0

Views: 73

Answers (1)

kelunik
kelunik

Reputation: 6908

Yes, this is possible:

p { 
    text-overflow: ellipsis;
    white-space: nowrap;
}

more information: http://davidwalsh.name/css-ellipsis

Edit: This appears to work only for single-line elements. Another solution I found for multiple lines: http://www.mobify.com/blog/multiline-ellipsis-in-pure-css/

Upvotes: 2

Related Questions