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

Add another nested selector which makes all <a> tags that are direct children of <p> tags blue.

How would you guys solve this problem?

3 Answers

Jeff Lemay
Jeff Lemay
14,268 Points
.tag > .child {
  color: blue;
}

Class/element names are just examples. The key here is the angle bracket.

EDIT: this is an example for regular css. OP was looking for a SASS/LESS solution.

Jeff Lemay can you please be a bit more precise for the above edited question i tryed what you showed above maybe i done it wrong but it shows BUMMER! Try creating a rule with just '> a' in the selector, that's INSIDE the rule for 'p' tags.

I got it all figured outThanks Jeff and for anyone who has a future problem here is a great easy way to understand for learning visually

p { color: red;

a { color: red; }

a { color: blue; } }

Jeff Lemay
Jeff Lemay
14,268 Points

Gotcha. I assumed you wanted just regular ol' CSS but it looks like this was for SASS or LESS.

Jakob Wozniak
Jakob Wozniak
17,896 Points

So for this specific case, it would look like this:

p > a {
  color: blue;
}

I hope this helps!