Limited supportLimited browser support. Check compatibility before use.

Overview

The scroll-target-group CSS property sets the container where anchor links act as scroll markers. Using selectors such as :target-current, you can style elements when a target has scrolled into view. It's an alternative to the ::scroll-marker-group pseudo-element, which generates scroll markers.

Browser support

Feature Desktop Mobile
Chrome
Edge
Firefox
Safari
Chrome Android
Safari iOS
140
140
140
auto
Experimental
140
140
140
none
Experimental
140
140
140
1+Supported (version) Not supported Has note Sub-feature descriptions sourced from MDN Web Docs (CC BY-SA 2.5)

Syntax

CSS
.toc {
  scroll-target-group: self;
}
.toc a:target-current {
  font-weight: bold;
  color: #3498db;
}

Live demo

tochilight

CSS tochilight demo.

PreviewFullscreen

tab style nav

CSS tab style nav demo.

PreviewFullscreen

Sidebar

CSS sidebar demo.

PreviewFullscreen

Use cases

  • Using scroll-target-group

    The scroll-target-group CSS property sets the container where anchor links act as scroll markers. Using selectors such as :target-current, you can style elements when a target has scrolled into view. It's an alternative to the ::scroll-marker-group pseudo-element, which generates scroll markers.

Cautions

  • Limited browser support. Check compatibility before use.

Accessibility

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

Powered by web-features