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 CSS Foundations Advanced Selectors Additional Pseudo-Classes

Ryan Ganley
Ryan Ganley
1,943 Points

Not working

I am using: a[href*="#"] { background: tomato; }

2 Answers

It's actually asking you to select any element whose ID matches the current target in the URL. Meaning if you go to www.example.com#abc, it wants the element where ID="abc" to have a tomato colored background.

To do this, you will actually use the :target {} selector, since you want the actual target and not the anchor that links to that target. You can learn more about this in the associated video for that challenge (Additional Pseudo-Classes) at around the 2:00 mark.

Hi Jason,

URLs with an # followed by an anchor name, link to a certain element within a document. The element being linked to is the target element. The :target selector can be used to style the current active target element.

Jeff