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 trialAlyssa Nienstedt
13,114 PointsFlex:1? clarification
I thought I understood flexbox, but I seem to be missing something. In setting flex:1 shouldn't each of the .card elements "grow" to take up the entire width of the .main-content container (thereby stacking them)? Why would they be positioned next to one another?
2 Answers
Karan Nahar
16,157 PointsHi! Alyssa. When you set flex: 1 your card elements will take equal widths in the container horizontally . If you want your card items to be stacked on top of each other vertically and take up the full width give the flex container a flex-direction: column.
Alyssa Nienstedt
13,114 PointsHi Karan, Thanks for you response. I saw the flex-direction was set to column for .card and must have similarly attributed that rule to the container which threw me off. Don't try to code at midnight when you're tired haha Thanks again.
David Kanwisher
9,751 PointsI scratched my head over the same thing for longer than I care to admit. Thanks for asking such a great question, and thanks for the great answer Karan!