Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

CSS CSS Flexbox Layout Flexbox Properties Wrapping Flex Items

Aaron Selonke
Aaron Selonke
10,323 Points

The container only flexes to a certain width before it list items begin 'breaking out' of the container

Here you can see a screen shot, with the code from the video http://uploadpie.com/tlKrz

Once I shrink the screen below 225px, the list item elements are no longer contained in the box...... What is the reason for that?

Michal Janecek
Michal Janecek
8,194 Points

You need to define the flex-grow and flex-basis property for the item class, otherwise the flex-items won't shrink or grow with the container. You can check out these two articles https://css-tricks.com/almanac/properties/f/flex-grow/ and https://css-tricks.com/almanac/properties/f/flex-basis/.

1 Answer

Steven Parker
Steven Parker
220,378 Points

This is only a guess, since you did not show your code, but it looks like you may not have defined the "flex" property (which combines flex-grow, flex-shrink, and flex-basis) on the items, which would make them shrinkable. Or, you might have a size constraint on them that prevents them from shrinking.

If you still need help, share your code, or better yet snapshot your workspace and share the link to that.