Limited supportLimited browser support. Check compatibility before use.

Overview

The :target-current CSS pseudo-class selects the active scroll marker (as in ::scroll-marker), while the :target-after and :target-before pseudo-classes select the inactive markers preceding and following the active scroll marker.

Browser support

Feature Desktop Mobile
Chrome
Edge
Firefox
Safari
Chrome Android
Safari iOS
:target-after
Experimental
142
142
142
Other
142
142
142

`:target-current`

135
135
135
1+Supported (version) Not supported Has note Sub-feature descriptions sourced from MDN Web Docs (CC BY-SA 2.5)

Syntax

CSS
.item::scroll-marker:target-current {
  background: #3498db;
}
.item::scroll-marker:target-before {
  opacity: 0.5;
}

Live demo

currentta-get

CSS currentta-get demo.

PreviewFullscreen

past. m-ka-

CSS past. m-ka- demo.

PreviewFullscreen

progressindicator

CSS progressindicator demo.

PreviewFullscreen

Use cases

  • Using Scroll marker target pseudo-classes

    The :target-current CSS pseudo-class selects the active scroll marker (as in ::scroll-marker), while the :target-after and :target-before pseudo-classes select the inactive markers preceding and following the active scroll marker.

Cautions

  • Limited browser support. Check compatibility before use.

Accessibility

  • Make sure visual changes are conveyed appropriately to assistive technology.

Powered by web-features