Selecting Descendants

Sometimes we need to select elements that are descendants of another element.

Let's look at an example:

<div class="paragraph-group">
	<p>...</p>
	<p>...</p>
</div>
.paragraph-group p {
	color: orange;
}

We can see that the space indicates that the next selector should be a child. In our case, only the p elements that are descendants of elements with the class paragraph-group will be selected.

Instructions

Create a rule that selects li elements that are descendants of ul elements. Then add the following declaration: color: orange;.

Start programming for free

By signing up, you agree to the Terms of Service and Privacy Policy.

Or sign up with:

11/12

Selecting Descendants | Start Coder