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 Using Combinators in Selectors

Child selector to target anchor

I have written in the code:

.main <a { color: green: font: bold: } and it is not working

4 Answers

Hello Carolyn,

It looks like there are a few issues in this code. Firstly we'll want to select the child of a div instead of the class "main":<br /> div <a { color: green: font: bold: }

Next, we'll want to switch the < around to > and put a space after it:<br /> div > a { color: green: font: bold: }

Bolding will be considered a change to the "weight" of the font, so we'll need to change "font" to "font-weight": div > a { color: green: font-weight: bold: }

Finally we'll need to put semi-colons ( ; ) instead of colons ( : ) after each statement: div > a { color: green; font-weight: bold; }

The quiz is usually pretty good at giving you error messages to lead you in the right direction. For example, with your code it starts with a message that the child selector is ">".

You may want to review the videos one more time before proceeding.

Hi Carolyn,

You'll need to flip your combinator to face the other way. Try:

.main > a {declarations}

Hope that works for you!

Hi Carolyn, you have to use the greater than sign, which is the Child Selector combinator.

.main > a { color: green: font: bold: }

Thank you. This helped.