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 trialJason Thompson
8,158 PointsWhy would you ever use no-wrap?
I'm curious. I see how in this video there are methods to bring wrapping back with break-word etc etc. But wouldn't it be best to just leave wrapping in place and style from there?
I don't see why you would remove wrapping if all it will do is take text outside its container. Just curious to hear thoughts on this.
2 Answers
Steve McKinney
29,274 PointsUsing white-space: nowrap
on text is handy where it concerns text-overflow: ellipsis
as it only works on single lines. Other reasons may be for such things as buttons, sometimes it may be 1 or 2px difference between the button breaking onto a new line and not, so while not 100% ideal it can be overcome with this.
Julian Price
11,760 PointsI think the best example would be if you want to limit character lengthy of title element that you want to display on a single line. Maybe?
Jason Thompson
8,158 PointsThanks Julian!
John Locke
15,479 PointsJohn Locke
15,479 Points+1 To this. You can force overflow text to ellipsis by defining the width (you must do this) and white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
Jason Thompson
8,158 PointsJason Thompson
8,158 PointsThanks all for your responses! I thought this would be useful for a wordrpess type of situation. I didn't think about buttons. Great stuff!