Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Gareth Redfern
36,217 PointsHelp With CSS Text Overflow
Hi Guys,
I have just watched one of the css videos on text-overflow and using the
text-overflow: ellipsis;
I am having problems getting it to work. I have read the spec:
https://developer.mozilla.org/en-US/docs/CSS/text-overflow
and set up a codepen:
http://codepen.io/garethredfern/pen/729680cab4e63d9a373b14a0d70476da
Could anyone help?
3 Answers
Hardik Dangar
Courses Plus Student 856 PointsSupport for text-overflow: ellipsis requires white-space: nowrap this makes it to a single line, and it will not work for multiple lines.
I think you have to do this via Javascript something like http://www.jeremymartin.name/projects.php?project=jTruncate
One solution via pure css will require lot of work, http://www.mobify.com/dev/multiline-ellipsis-in-pure-css
Gareth Redfern
36,217 PointsAhh right thanks Hardik, I thought it looked too good to be true as I hadn't come across it before. I am using multiline text so that would be my issue.
James Barnett
39,199 Points@Gareth -
I'm not sure if this is exactly what you are going for but there's also the CSS3 property word-wrap: break-word. It has good cross-browser support including IE6.
Check out the codepen