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

I am unclear what is wrong with my code for this Sass request that I create a hover style for direct descendants of a.

p { a { color: red;
}

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

3 Answers

geoffrey
geoffrey
28,736 Points
p{
  a{
    color:red;
  }
  &>a{
    color:blue;
    &:hover{
      opacity:0.5;
    }
  }
}

Hey Timothy, firstly there was no real need to add an 'a' tag that wasn't a direct descendant. But the real issue was simply that you forgot one closing bracket.

p {

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

Hi Motty,

The 1st task of the challenge requests that all <a> tags within <p> tags are colored red. So I think you need that first nested selector. The html even has a link that's two levels deep and should be colored red.

Thanks fellas