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 Foundations Selectors Type, Class, and ID Selectors

Daniella Davidoff
Daniella Davidoff
1,176 Points

How do I select the em inside the paragraph, using a descendant selector, to set its color to red?

I have included the <span> in my html doc. I don't know what I am missing. The code challenge keeps saying, "check the selector in your CSS. Make sure the color is set to red.""

index.html
<!DOCTYPE html>
<html>
<head>
    <title>CSS Selectors</title>
    <link rel="stylesheet" href="cc1-main-styles.css" type="text/css" media="screen">
    <link rel="stylesheet" href="style.css" type="text/css" media="screen">
</head>
<body>
    <h1><em>Hello</em> World!</h1>
    <div>
        <p>
      <em> <span>Lorem ipsum dolor</span></em> sit amet, consectetur adipiscing elit. Nunc pulvinar consequat tortor, nec venenatis erat elementum scelerisque. Curabitur sit amet risus nisi. Aenean aliquet euismod augue at viverra. Ut varius arcu in lorem iaculis ullamcorper. Integer eu rutrum quam.
        </p>
    </div>
</body>
</html>
style.css
/* Complete the challenge by writing CSS below */

body {
  background: lightblue;
}

h1 {
  color: darkblue;
}

em span {
  color: red;
}
Austin Klenk
Austin Klenk
4,399 Points

Add a class to your em.. for say-

<h1><em class="h1">Hello</em>world</h1>

And when you have the class try these

body h1 em {}

Or

em.yourclassname {} - note, they are all together

Or

.yourclassname em {} - note the space between.

Hope this helps. :)

1 Answer

Guil Hernandez
STAFF
Guil Hernandez
Treehouse Teacher

Hi Daniella Davidoff,

No classes needed. The em span descendant selector you wrote is close. But, instead of targeting a span element that's inside an em, target a span that's inside a p. Hope this helps. :)