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

Question 4: My answer is working but not passing the test

For Sass Basics > Getting started > Advanced Nesting challenge, question 4:

The question is a little hard to understand. I think I see what it wants, and I've tested my answer in sublime and it works but it isn't accepted as valid. Can anyone help me understand what it wants?

I don't know if it's kosher to post my answer here but I have a '.footer &' nested within a p and then an a, as it's calling for.

Thanks!

Ken Alger
Ken Alger
Treehouse Teacher

Zack;

Please post the code you are using and we'll try to get you sorted out.

Ken

Great thanks Ken!

p {
  a {
    color: red;
    .footer & {
      color: purple;
    }
  }
  > a {
    color: blue;
    &:hover {
      opacity: 0.5;
    }

  }
}

2 Answers

Ken Alger
STAFF
Ken Alger
Treehouse Teacher

Zack;

The task is asking to select the div with the class of footer, correct? Therefore your selector would be div.footer, and then use the post-selector ampersand, so your selector will look like:

div.footer & {
   // properties go here
}

Make sense?

Ken

Ryan Field
Ryan Field
Courses Plus Student 21,242 Points

Sorry for bumping such an old post, but I was just curious: is it only the challenge that you need to write the 'div' part of that, or can it be omitted if, for instance, you only had one div with the 'footer' class on the page?

I put my answer there as the first thing I did, but didn't put the div and it asked me to check my work again, which led to a considerable amount of confusion.

Wonderful! It worked! Thanks Ken :)