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!
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
Tyler Halstead7,987 Points
Why do you have to target individual classes when using the display property, but not the align-items property?
It seems like in order to display main-header and main-nav as flex, they both have to be directly targeted in CSS, yet if you wanted to center align the list in main-nav, you can just target .main-header and use align-items. Are the 2 properties treated differently in some way?
I think your talking about the relation between parent (container) and children (items) in flexbox.
Flexbox uses the relationship between the two to create the layout. As above you mentioned adding display flex to the container will define the element as a flexbox container. Adding align items center is now talking about all direct children to that container.
so if main-header is defined as a flex container and the direct children is the main-nav then using the
align-items property will target all direct children on the main-header.