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

Code Challenge: CSS Foundations Selectors Type, Class, and ID Selectors

Does anyone know what I did wrong here?

The question is Select the em inside the paragraph using a descendant selector. Set its color to 'red'. My code is as below:

body{ background-color: lightblue; }

h1 { color: darkblue; }

h1 em{ color: red; }

Thanks in advance!

Brendon Attebury
Brendon Attebury
3,866 Points

Okay, I am having the same issue except when I type the color as red the text actually turns red. Here is what I have written:

p em{ color:red; {

Brendon Attebury
Brendon Attebury
3,866 Points

oops sorry looks like this:

p em{ color:red; }

hi Brandon,

I don't know what went wrong with your case. I think you are already correct with the code and the text is supposed to be red.

1 Answer

Yes, you didn't use the descendant selector, which is " > ".

You also selected an h1 instead of a paragraph.

Hi Kevin,

Thanks Kevin. The error is because I've used h1 instead of paragraph. Thanks for pointing that out.