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

SAAS challenge part 4

Challenge task 4 of 4 We want to add an exception for <a> tags that are are in the <div> with a class of .footer: those links should be purple. Use the post-selector ampersand to achieve this.

I tried several things including } html.footer &: a { color:purple; } }

3 Answers

Chris Dziewa
Chris Dziewa
17,781 Points
/* Write your SCSS code below. */

p {

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

This will work for you. Notice how the div.footer & selector is nested within the a tag.

Hey Chris, Thanks! Worked perfectly and was very helpful.. Really appreciate your assistance Have a great rest of the week.

Byron

Chris Dziewa
Chris Dziewa
17,781 Points

You are most welcome, and have a great week too!

James Barnett
James Barnett
39,199 Points

Byron Horn - Do you understand why Chris Dziewa's code works?

Hi James, Yes i understand now, sometimes it takes me seeing the correct way to connect the dots. I appreciate the follow up. Have some fun this weekend.

Byron