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 trialChristian Hamilton Heidemann
3,277 PointsAdditional Pseudo Classes
Hi Treehousers.
I have a problem regard the second challenge in Additional Pseudo Classes .
Challenge question: Create a new rule using the selector that targets an element only if its ID matches the hash in a URL. Set the background color to tomato.
I have tried following
:target([id="s2"]) { background-color: tomato; }
added a new selector in the HTML ect.
Please help me so I can proceed.
Best regards Christian
2 Answers
Adam Sackfield
Courses Plus Student 19,663 PointsI have not used these for a while and may be wrong if so please post a link to the question and i will investigate but i think your can leave out the id part, thus
:target { background-color: tomato; }
Thanks
Tom Bedford
15,645 PointsYou're being more specific than needed.
It's asking for a generic rule to color the background "tomato" if the element's ID is the same as that in the URL hash.
i.e. the rule should allow for any ID that matches the hash (not only one ID).
hint: you don't need to add anything to the HTML
Christian Hamilton Heidemann
3,277 PointsChristian Hamilton Heidemann
3,277 PointsWooow this was just so wierd.
I have also tried the option above with error but thetreehouse have just accepted...
Thanks guy's!
Cheers!
Adam Sackfield
Courses Plus Student 19,663 PointsAdam Sackfield
Courses Plus Student 19,663 PointsIf still unsure of what is actually happening then I would re watch the video and check the W3C site for information on that property. Also if you could choose a best answer to mark as solved that would be great.