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 Sass Basics (retired) Getting Started with Sass Advanced Nesting

SASS error with nesting

Hi guys, what exactly is wrong with this scss code for a task: "Add another nested selector which makes all <a> tags that are direct children of <p> tags blue." ?

p {
    > a {
    color: blue;
  }
    a {
    color: red;
  }
}

I get this error: "Bummer! The colour of <a> elements that are children of <p> elements should be set to 'blue'."

Thanks ;)

2 Answers

It's the order that you have them.

Both selectors, p > a and p a have the same specificity so whichever one comes later takes precedence. So you are making all direct child links blue but then you're making all links red including direct child links.

Manuel Corazzari
Manuel Corazzari
13,514 Points

you are right jason! I just fixed this on my following our advice

Thank you Jason!