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

Razvan Ciocanel
Razvan Ciocanel
16,944 Points

How can I solve this nesting issue?

I have to create an exception for an a tag that is in the .footer div. This is the bit of code I used:

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

Any ideas why this ain't working?

Wayne Priestley
Wayne Priestley
19,579 Points

Hi Razvan,

I edited your code so it is easier to read.

How to use Markdown to display your code

3 Answers

Hi Razvan,

Do you have all that nested inside a p block?

You have the & in the right spot. The challenge wants you to be more specific with the selector. It's a div with a class of "footer". Not just any element with a class of "footer"

Razvan Ciocanel
Razvan Ciocanel
16,944 Points

Thanks so much, adding div.footer & worked! :)

Try using &.footer instead.

Razvan Ciocanel
Razvan Ciocanel
16,944 Points

tried that too, but it just says: "Bummer! Please use the ampersand selector following the selector for the .footer div."

Wayne Priestley
Wayne Priestley
19,579 Points

Hi Razvan,

It looks to me like you've created the code so that you have an exception for a .footer thats created in an a tag.

In other words, the wrong way round. at least thats how it appears to me, its been a little while since I used any Sass.