Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / CSS

::scroll-marker — scroll navigation marker

The ::scroll-marker pseudo-element creates a control that, when activated, scrolls to its originating element or, if it originates from a ::column pseudo-element, to that column. It requires a marker group on a scroll container.

Version: CSS modules; structured CSSWG indexes reconciled with pinned MDN BCD; Chromium 152 scope gate, per-example verification still required

Syntax

selector::scroll-marker { content: "…"; }
selector::scroll-marker:target-current { /* active marker styles */ }

::scroll-marker is a pseudo-element, not a class on an HTML element. The selector .panel::scroll-marker styles a generated control associated with .panel.

To generate a marker, set content to a value other than none. To generate a group, set scroll-marker-group to a value other than none on an ancestor scroll container. A marker is associated with the nearest ancestor that has a generated marker group. An intervening scroll container without a group does not prevent association with an outer ancestor's group. Markers enter that ancestor's ::scroll-marker-group in document order. Activating a marker that originates from an element scrolls to that element. If the marker originates from a ::column pseudo-element, activation scrolls to that column, not to the element that generates the columns. :target-current selects the active marker, not necessarily the focused one.

This feature belongs to a draft specification. Test behavior in the target browser; accepting the selector alone does not establish functionality. Preserve visible focus and the ability to scroll without markers.

Examples

<!doctype html>
<meta charset="utf-8">
<title>Scroll markers</title>
<style>
  .scroller {
    width: 240px;
    height: 120px;
    overflow: auto;
    scroll-marker-group: after;
  }
  .panel {
    height: 120px;
    background: #eee;
  }
  .panel::scroll-marker {
    content: attr(data-label);
    padding: 4px 8px;
    color: #222;
  }
  .scroller::scroll-marker-group {
    display: flex;
    gap: 8px;
    height: 32px;
  }
  .panel::scroll-marker:target-current {
    color: #fff;
    background: #222;
  }
  .panel::scroll-marker:focus-visible {
    outline: 2px solid blue;
  }
</style>
<div class="scroller">
  <section class="panel" data-label="1">Panel 1</section>
  <section class="panel" data-label="2">Panel 2</section>
</div>

Result

Expected in a supporting browser: Panel 1 is initially visible, with markers 1 and 2 below the scroller. Activating marker 2 scrolls to Panel 2 and gives marker 2 a dark background.

The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.

Sources