:target Selector

Selects the target element indicated by the fragment identifier of the document's URI.


If the document's URI contains a fragment identifier, or hash, then the :target selector will match the element with an ID that matches the identifier. For example, given a document with a URI of https://example.com/#foo, $( "p:target" ) will select the <p id="foo"> element.

Further discussion of this usage can be found in the W3C CSS specification.

Looking for a Web Developer?


Hi! I'm Basti, author of this site. If you are looking for a web developer with 15+ years of experience, holla at me!

Be it the good 'ol jQuery, vanilla JS or modern frameworks like Vue and Svelte, front- or backend, I can help you.

Just write me at jobs@jqapi.com :)