Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / CSS

view-timeline-axis — axis of a named view progress timeline

view-timeline-axis selects the scrolling axis used by an element’s named view progress 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

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

view-timeline-axis sets the axis of an element’s named view progress timeline. Progress follows the element passing through an ancestor’s scrollport, rather than elapsed seconds or overall scrolling progress.

block and inline are logical axes determined by the scroll container’s writing mode; x is horizontal and y is vertical. The initial value is block. The property is not inherited and is not animatable.

The # in the syntax means a comma-separated list, coordinated with view-timeline-name. Setting an axis alone neither names a timeline nor attaches an animation: also use view-timeline-name and animation-timeline. Select an anonymous timeline’s axis inside view(), not with this property.

The example ties opacity to the element’s vertical passage through the container. Expected values at scrollTop positions 0, 150, and 300 are 0, 0.5, and 1, respectively. Missing suitable scrolling can leave the timeline inactive; check behavior in the target browser.

Examples

<!doctype html>
<meta charset="utf-8">
<title>view-timeline-axis</title>
<style>
  .scroller {
    height: 200px;
    overflow: auto;
    writing-mode: horizontal-tb;
  }
  .spacer { height: 200px; }
  .subject {
    height: 100px;
    background: teal;
    view-timeline-name: --subject;
    view-timeline-axis: y;
    view-timeline-inset: 0;
    animation: fade linear both;
    animation-timeline: --subject;
  }
  @keyframes fade {
    from { opacity: 0; }
    to { opacity: 1; }
  }
</style>
<div class="scroller" tabindex="0" aria-label="Scroll demo">
  <div class="spacer"></div>
  <div class="subject"></div>
  <div class="spacer"></div>
</div>

Result

Expected opacity at scrollTop 0 / 150 / 300: 0 / 0.5 / 1.

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