Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / CSS

scroll-timeline-axis — scroll progress axis

The scroll-timeline-axis property selects the scrolling axis for a named timeline. It distinguishes the logical block and inline axes from the physical x and y axes.

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

Syntax

scroll-timeline-axis: [ block | inline | x | y ]#;

scroll-timeline-axis selects the axis of a named timeline identified by scroll-timeline-name. Its initial value is block; it is neither inherited nor animatable.

block and inline depend on writing mode; x is horizontal and y vertical. The scroll origin still depends on writing mode. The # syntax allows a comma-separated value list for named timelines.

This property does not enable scrolling. Without a scrollable range on the selected axis, the timeline is inactive. Connect an animation using animation-timeline; the example uses a container descendant. This is a draft specification, not a support guarantee.

Examples

<!doctype html>
<meta charset="utf-8">
<title>scroll-timeline-axis</title>
<style>
  .scroller {
    width: 240px;
    height: 120px;
    overflow: auto;
    writing-mode: horizontal-tb;
    direction: ltr;
    scroll-timeline-name: --progress;
    scroll-timeline-axis: x;
  }
  .track { width: 720px; }
  .indicator {
    width: 80px;
    height: 40px;
    background: teal;
    animation: fade linear both;
    animation-timeline: --progress;
  }
  @keyframes fade {
    from { opacity: 0.2; }
    to { opacity: 1; }
  }
</style>
<div class="scroller" tabindex="0" aria-label="Horizontal scroll demo">
  <div class="track">
    <div class="indicator"></div>
  </div>
</div>

Result

Expected opacity at horizontal scroll offsets 0px, 240px, and 480px: 0.2, 0.6, and 1 respectively. No console output.

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