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

Steven Romano
Steven Romano
10,024 Points

Challenge task 4 of 4

So I'm not sure where I should nest the last part of the challenge. First, is it suppose to be list this

        .footer & {
              color: purple;
             } 

Next I'm not sure where it should go in the code.Does it nest inside the &:hover section?

2 Answers

Steven Romano
Steven Romano
10,024 Points

So I got it to work, with the help of another post. But what I don't understand is why did I have to put a div in front of the .footer. My final output was like this

p {
   a {
       color: red;
      div.footer & {
          color: purple;
         }
     }
}

I understand the ampersand. but couldn't have have just gotten away with the .footer instead of div.footer

thanks

In practice, most likely you would use .footer by itself. This particular challenge simply wanted you to be more specific. div.footer has a higher specificity than .footer.

They want you to be more specific with the selector. It's a div with a class of "footer"

It can be nested inside either the a rule or the > a rule.