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 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
231,269 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.