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 Understanding Flexbox Flexbox Basics and Terminology

1 Answer

A direct child is any node directly under a given selector, so for example:

div > p {
    color: red;
}

The above would only apply the color red to paragraphs that are directly inside of a div. That means if you had this structure:

<div>
<p>This would be red</p>
<p>This would be red</p>
<p>This would be red</p>
<p>This would be red</p>
<p>This would be red</p>

<header>
    <p>This would NOT be red</p>
</header>
</div>

The paragraph inside of the header would not have the color red applied to it.

Nour El-din El-helw
Nour El-din El-helw
8,241 Points

Oh! Thanks a lot for making it very clear. :)