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

James Barrett
James Barrett
13,253 Points

Why did my SASS code not pass this challenge?

On part 2 of the challenge, we are required to: 'Add another nested selector which makes all <a> tags that are direct children of <p> tags blue.'

Code that didn't pass:

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

Code that passed:

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

Why did putting the '>' selector after the initial nested selector pass? Do both code snippets produce different outputs?

Thanks, James.

What's the difference between the two code snippets?

1 Answer

Andrew McCormick
Andrew McCormick
17,730 Points

your code snippets are the same, but it sounds like you tried putting the direct selector first and it didn't accept that (which I just confirmed). It seems like one of those times where the yest was just looking for a specific way of doing something. Since it asked you to add it, it assumed you would add it after what you did in the previous step, is my best gust.