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

Matthew Schmookler
Matthew Schmookler
8,970 Points

Challenge says to add an exception to the <a> of the <div> class .footer using an ampersand. My code isn't working

I've tried several combinations and I haven't been able to compete the challenge. This is my last attempt. I also nested the .footer inside of the original <a> tag and used various other configurations....nothing worked :(

/* Write your SCSS code below. */

p { a{ color: red; }

}

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

}

}

3 Answers

Clinton Hopgood
Clinton Hopgood
7,825 Points
p {
  a {
    color: red;
  }
  > a {
    color: blue;

    &:hover {
      opacity: 0.5;
    }
    div.footer & {
      color: purple;
    }
  }
}
Maciej Czuchnowski
Maciej Czuchnowski
36,441 Points

This should work, I think you're missing the div selector:

/* Write your SCSS code below. */

p {
  a {
    color: red;
  }

  > a {
    color: blue;
    &:hover {
      opacity: 0.5;
    }

    div.footer & {
      color:purple;
    }
  }
}
Matthew Schmookler
Matthew Schmookler
8,970 Points

ah thanks, for some reason I didn't think I needed the div selector....ooopsy :) thanks!