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 trialreena sah
9,017 PointsWe 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.
the following code I have written is not working. can somebody help?
p > a {
color: blue;
&:hover {
opacity: 0.5;
}
}
Kyle Meyer
5,459 Pointsreena sah
9,017 PointsThank you.
Surendra Kulkarni
6,826 PointsIf treehouse could check the wording of the question so that they convey the intended meaning, will help considerably to save time and frustration.
6 Answers
Kyle Meyer
5,459 PointsHi Reena,
The Sass you put in is technically correct and would work. Unfortunately, it's not exactly what the Code Challenge is looking for since it's about nesting more advanced selectors. It actually wants you to nest every rule. Here's the format it's looking for:
p {
a {
color: red;
}
> a {
color: blue;
&:hover {
opacity: 0.5;
}
}
}
We'll fix this so it's a little more forgiving and gives you better hints.
loannlam
Courses Plus Student 2,582 Pointssomething is wrong...I pretty had the same answer as you have here, but it keeps telling me "Bummer...."
Ralf Koller
4,506 Pointswhat is actually not working?
Raymundo Figueroa
Front End Web Development Techdegree Student 25,606 PointsTHX, HAD A WEEK WITH THIS CHALLENGE ..
MUZ140045 Tafadzwa Gumunyu
13,202 Pointsbest answer
NG GOR
15,527 Pointstry this guys p{
a{ color:red;
}
a{ color: blue; &:hover { opacity: 0.5; }
}
}
James Barnett
39,199 PointsWell for one thing the first step of that code challenge is ...
Use a nested selector to say all <a>
tags within <p>
tags are red.
Jay McGavren
Treehouse TeacherJay McGavren
Treehouse TeacherReena,
Steps 1 and 2 in that code challenge were allowing rules that weren't nested; they should have been required to be nested. Step 3 did enforce that requirement, which could understandably lead to confusion. We've fixed the challenge to check for nesting, and to provide helpful hints if the rules aren't nested.
If you have any further issues, please let us know at help@teamtreehouse.com . Sorry for the trouble!