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

CSS

Alex Weinberg
Alex Weinberg
2,726 Points

Make text fit parent container...

I'm wondering what the best way to do this is. Say I have a paragraph, and I want the text to stay within the element and not overflow. If the element resizes when I change the browser window size, I'd like the text to break at different points to fit within it. The only way I can figure out how to do this is word-wrap:break-word; but I'd like it to not break up any of the words. Is this possible?

1 Answer

You could try the overflow property. This page does a good job of explaining it: http://www.w3schools.com/cssref/pr_pos_overflow.asp

overflow: auto;

provides scroll bars if the content overflows.