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
205,587 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.