Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / CSS

::scroll-marker-group — scroll marker group

The ::scroll-marker-group pseudo-element styles the shared container of generated scroll markers, including their layout and spacing.

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

Syntax

selector::scroll-marker-group { /* declarations */ }

::scroll-marker-group selects the generated marker container, not an individual ::scroll-marker. The scroll-marker-group property on a scroll container enables its creation: before places its box before the container and after places it after. This is normally a sibling box; for the root element, it is placed inside instead.

The selector alone does not create markers. Descendants need ::scroll-marker with content other than none. Style the group with properties such as display: flex and gap, and the current marker with ::scroll-marker:target-current. This feature belongs to an evolving specification draft: verify behavior in the target browser rather than assuming compatibility.

Examples

<!doctype html>
<html lang="en">
<meta charset="utf-8">
<title>Scroll marker group</title>
<style>
  .scroller {
    display: flex;
    width: 280px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-marker-group: after;
  }
  .panel {
    box-sizing: border-box;
    flex: 0 0 100%;
    padding: 32px;
    background: #eee;
    scroll-snap-align: start;
  }
  .scroller::scroll-marker-group {
    display: flex;
    gap: 12px;
    align-items: center;
    width: 280px;
    height: 48px;
  }
  .panel::scroll-marker {
    content: attr(data-label);
    padding: 6px;
  }
  .panel::scroll-marker:target-current {
    font-weight: bold;
    outline: 2px solid currentColor;
  }
</style>
<div class="scroller" role="region" aria-label="Numbered panels">
  <div class="panel" data-label="1">Panel 1</div>
  <div class="panel" data-label="2">Panel 2</div>
  <div class="panel" data-label="3">Panel 3</div>
</div>
</html>

Result

In a supporting browser, Panel 1 is initially visible, with markers 1, 2, and 3 below the scroller. Activating marker 3 scrolls to Panel 3 and highlights marker 3.

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