:target

The :target pseudo selector in CSS matches when the hash in the URL and the id of an element are […]

.element:target { background: yellow; }
Continue Reading

:target-current

The :target-current CSS pseudo-class selects active scroll markers, meaning it’s only valid when used with the ::scroll-marker pseudo-element

::scroll-marker:target-current { background: black; }
Continue Reading

::target-text

The ::target-text pseudo-element selects a text fragment, usually the ones created by search engines.

p::target-text { /* ... */ }
Continue Reading

:target-before

The :target-before CSS pseudo-class selects all scroll markers prior to an active scroll marker (:target-current) within a scroll container.

::scroll-marker:target-before { background: hsl(from black h s l / 50%); }
Continue Reading

:target-after

:target-after is a CSS pseudo-class that selects all scroll markers that come after an active scroll marker (:target-current) within a scroll container.

::scroll-marker:target-after { background: red; }
Continue Reading