Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

CSS

Stuck on "Select the class 'intro' and set its font weight to bold."

Is anything wrong with the code? It doesn't work and I can't figure out why.

body {
  background-color: lightblue;
}
h1 {
  color: darkblue;
}
p em {
  color: red;
}
.intro {
  font-weight: bold;
}
James Barnett
James Barnett
39,199 Points

Without a link to the code challenge you are having issues with, someone would have guess which one it is, to be able to test out their solution.

2 Answers

Mike Bronner
Mike Bronner
16,395 Points

There are two reasons it could be failing:

[incorrect advice removed - see James' explanation setting me straight. :)]

  • there may be an issue with the HTML file. Perhaps your class declaration is incorrect?

I just went through the challenge and solved it successfully using the same .intro class declaration like you have listed above.

James Barnett
James Barnett
39,199 Points

> your "p em" selector is not what the previous step asked for -- they specifically said "using a descendant selector"

Mike Bronner -

I think you got confused here between the descendant selector and the child selector. A space is the correct combinator for a descendant selector whereas a child selector uses a >.

for reference: http://learn.shayhowe.com/advanced-html-css/complex-selectors

Mike Bronner
Mike Bronner
16,395 Points

Yes, you're right. Interestingly enough, the child-selector passed the test -- probably because it fulfilled the same criteria for this test. :)

James Barnett
James Barnett
39,199 Points

Yitong Zhang - Your CSS is right, however you didn't post your HTML. This challenge is 6 steps, 4 of them are CSS and 2 are HTML. My guess is that your issue is related to how you added the class name.