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

Brian Doherty
Brian Doherty
8,165 Points

Cannot get past this task

task 2 on advanced nesting.

2 Answers

Ben Falk
Ben Falk
3,167 Points

This is the correct code, using the direct child symbol ">":

/* Write your SCSS code below. */
p {
    a { 
    color:red; 
  }
    > a {
    color:blue;
  }  
}

The order does seem to matter -- when I put "> a" before the "a" styling, the challenge didn't pass. I think that is because if you switch it, all "p a" become red, and the blue color gets overwritten.

Brian Doherty
Brian Doherty
8,165 Points

Ben you're a legend! Thank you. I was using

.entry p {

     a {color: red;}

}

from the first task so ".entry" was only selecting the .entries and not all the p tags. Thanks again!