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 Building a Layout with Flexbox Creating a Three Column Layout with Flexbox

Why do we target .col instead of .row?

Can someone clarify for me how we know when to target .col instead of .row? I'm not sure I get the significance of targeting the parent div vs. the individual items (sharing the common .col class). gulp

2 Answers

Watching the video till this point, it specifies when to target the parent and the child element. For example, flex grow, basis and shrink don't work on the parent element. In order to use flex grow, you need to target the individual item.

Just the same way you can't use justify-content or align-items on the child element. You can only use align-self. One other property you can't use in the parent element is the Order property.

So we are selecting .col because .row is the parent.

Got it, thanks!