← TechnologyThe essentials of

:target highlights purpose of address fragment

Publisher: ResumeMaker • 1 source

Published: 22 Oct 2026 13:13 · Updated: 22 Oct 2026 13:13

AI source check: 21 Oct 2026 13:48. This is not editorial approval.

In a few sentences

In brief

CSS can show which section the address leads to.

Useful to know

The pseudoclass :target matches the element to which the fragment in the current URL. points At an address ending in #details, the target is usually an element with id="details". [1]

Example: section:target { background: #fff5c2; }. This is convenient for a long reference book where the reader must recognize the section after opening a link. Not a common handler on every click: the state follows the address fragment. If the application changes navigation programmatically, check how it updates URL and browser history.

Sources

For further detail and to check the information:

  1. [1] MDN — :target ↗