Spec-Zone.ru › CSS

`:target-current` CSS pseudo-class

Baseline Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.

Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.

The :target-current CSS pseudo-class selects the active scroll marker — the scroll marker of a scroll-marker-group that is currently scrolled to. This selector can be used to style the active navigation position within a scroll marker group.

Note: The :target-current pseudo-class is only valid on ::scroll-marker pseudo-elements and elements that have been designated as scroll markers using the scroll-target-group property.

Syntax

:target-current {
  /* ... */
}

Examples

See Creating CSS carousels and ::scroll-marker for complete examples that use the :target-current pseudo-class.

Basic usage

::scroll-marker {
  background-color: white;
}

::scroll-marker:target-current {
  background-color: black;
}

Specifications

Specification
CSS Overflow Module Level 5
# selectordef-target-current

Browser compatibility

Desktop Mobile
Chrome Edge Firefox Opera Safari Chrome Android Firefox for Android Opera Android Safari on iOS Samsung Internet WebView Android WebView on iOS
target-current
135
135
No
120
No
135
No
89
No
29.0
135
No

See also

  • scroll-marker-group
  • scroll-target-group
  • :target-before, :target-after
  • ::scroll-marker
  • ::scroll-marker-group
  • Creating CSS carousels
  • CSS overflow module
  • CSS Carousel Gallery via chrome.dev (2025)

© 2005–2025 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Selectors/:target-current

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API