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
Pierre Villanueva
6,545 PointsSass Basics: Advanced Nesting code challenge
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.
I entered:
p {
a {
color: red;
}
}
p > a {
color:blue;
&:hover {
opacity: 0.5;
}
}
What am I doing wrong? I double checked the video and my syntax seems okay.
7 Answers
Michel van Essen
8,077 Pointsp {
a {
color: red;
}
}
p {
> a {
color: blue;
&:hover {
opacity: 0.5;
}
}
}
you forgot some curly brackets
OR BETTER
p {
a {
color: red;
}
> a {
color: blue;
&:hover {
opacity: 0.5;
}
}
}
since you can just next >a inside the p{ rather than repeating.
Brian Heil
1,539 PointsI think it's because you don't need the "p" in "p > a" (since you are already nesting inside the p selector.
Pierre Villanueva
6,545 PointsI appreciate everyone's help. Thank You!
Lauren Gray
5,576 PointsThanks for the help guys. I had the same issue with this.
Cedric Bell
10,712 PointsThanks Michael, I was stuck on that one.
Cedric Bell
10,712 PointsThanks Michael, I was stuck on that one.
Justin Galicic
Front End Web Development Techdegree Graduate 31,655 PointsUgh. I had opacity set to .5 instead of 0.5 and couldn't figure out why it wasn't passing.