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

gaster
PLUS
gaster
Courses Plus Student 3,997 Points

Sass basics ampersand challenge.

Seems like I've tried everything to get this to pass... No go! Could someone please help?

Front-end Web Development 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.

Bummer! Please use the ampersand selector following the selector for the .footer div.

/* Write your SCSS code below. */ p { a { color: red; } > a { color: blue; &:hover { opacity: 0.5; .footer & { color: purple; } } } }

Nachiket Kumar
Nachiket Kumar
3,590 Points

There are 2 issues here:

  1. As Todd says, you need to be more specific (although that is not clear enough from the exercise instructions, you need to say div.footer and not just .footer.

  2. You need to nest the post selector ampersand under the a tag, not as you currently have it. What you have is actually selecting the &:hover instead of the a.

Hope that helps

gaster
gaster
Courses Plus Student 3,997 Points

Alright, thank you very much! I'll try that and see if it works. It seems like i've attempted everything but that, so your help is much appreciated!

2 Answers

Todd Brotze
Todd Brotze
7,461 Points

I can empathize, had the same problem. Turns out they want you to be specific with the selector and indicate "div" ahead of the "footer" class, so it would look like: div.footer& Took me a little while to figure it out. Hopefully that works for you.

gaster
gaster
Courses Plus Student 3,997 Points

O.k. I'll try that... Thank you so much! That's one thing I hadn't thought to write.

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

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