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 trialApril Carter
15,568 PointsTrouble with post selector
I am starting off with
p { a { color: red; }
a { color: blue; &:hover { opacity: 0.5; } } }
The task is to make the <a> tag within the .footer class purple, which I am assuming meas that I need to insert
.footer & { color: purple; }
If that is correct, then it makes sense to me to put it after color: red; in the <a> tag selector at the top, like so.
p { a { color: red; .footer & { color: purple; } }
a { color: blue; &:hover { opacity: 0.5; } } }
That way, the "&" will select the <p> and <a> tags above it. When written out, it seems to me like it should come out to .footer p a {}, which would be the proper way to select the <a> tag in the footer for styling in regular CSS. However, I've tried not only that, but many other configurations that don't make nearly as much sense, and I can only conclude that I am either selecting the <a> tag in the .footer class incorrectly (using the post selector incorrectly), or there is somewhere it can be placed within this code that I somehow haven't though about.
The answer is probably quite simple, but any help would be appreciated nonetheless.
2 Answers
Giuseppe Elia Brandi
Front End Web Development Techdegree Graduate 69,630 PointsThis is the code:
/* Write your SCSS code below. */ p { a { color: red; div.footer & { color: purple; } }
a { color: blue; &:hover { opacity: 0.5; } } }
April Carter
15,568 PointsOooooooh! I wasn't adding the div. Well I feel silly. Thanks for your help! :)