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 Selector Problem

I have been trying to complete the challenge question: "Change h3 with class "important_headline" to have text color red.

What am I missing? I'm sorry to ask but I've been trying this for days in several different permutations and nothing works.

h3 [class="important_headline"] { color:red; }

1 Answer

I'm assuming you know that dots (.) select classes in CSS. In this case

 .important_headline{
    /* styling goes here */
 }

... will select all elements with the class important_headline. To get to all of the h3 tags that have this class you just combine the two:

 h3.important_headline{
    /* styling goes here */
 }

CodePen: http://cdpn.io/mibcg

Note: Do not seperate h3 and .important_headline with a space. This would resemble a descendant selector and would select all elements of the class important_headline that are descendants of an h3 tag. Learn more at the W3C.

HTH :D