Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

CSS Sass Basics (retired) Getting Started with Sass Advanced Nesting

Opacity wont set from Sass

Challenge task 3 of 4 We want to add a style to our previous Sass code declaring that on hover, all direct <a> children have an opacity of 0.5. Use the ampersand selector to achieve this, rather than repeating the > a direct child selector.

 &:hover {opacity: 0.5;}

Keeps returning to set the opacity to 0.5

3 Answers

Tom Bedford
Tom Bedford
15,645 Points

You have closed the >a curly bracket before adding &:hover. When it compiles it's making p:hover not p > a:hover. There also doesn't appear to be a final closing bracket for p.

Your current code with (with the added final closing bracket) would compile to:

p a {
  color: red;
p > a {
  color: blue;
p:hover {
  opacity: 0.5;

wow i just saw this. thanks alot

so this is correct?

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