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

Kris Michalies
Kris Michalies
1,786 Points

Create a new rule using the selector that targets an element only if its ID matches the hash in a URL. Set the backgr...

I'm not sure what is being asked for on this question.

2 Answers

Hi Kris

Have you thought about the CSS pseudo class ":target"?

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.

Example:

For example, if the URL was http://www.teamtreehouse.com/index.html**#section2**, the :target selector would match the element that had an id attribute of "section2":

:target { background-color: etc.... }

Hope this gives you the right hint. Good luck with the challenge.

Cheers, Carsten

Kris Michalies
Kris Michalies
1,786 Points

Thanks, that helps. I was way over thinking the question.

Don't worry, happens to me all the time :) Good luck with the rest of the challenges.