Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / CSS

view-timeline-name — naming view progress timelines

view-timeline-name assigns names to timelines based on an element moving through a scrollport. An animation references a name through animation-timeline; its progress depends on scrolling rather than elapsed seconds.

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

Syntax

view-timeline-name: [ none | <dashed-ident> ]#;

view-timeline-name declares named view progress timelines on the element whose position is tracked. Progress describes its box passing through the visible area of its nearest ancestor scroll container. It is neither the percentage of visible surface area nor the scroll progress of the whole document.

The value is a comma-separated list of none or <dashed-ident> names such as --card. none assigns no name at that list position. The initial value is none; the property applies to all elements, is not inherited, and is not animatable.

Naming alone does not run an animation: connect it with animation-timeline: --card. view-timeline-axis selects the axis (initially block), while view-timeline-inset adjusts the visibility range. The view() function instead creates an anonymous timeline. Place animation-timeline after the animation shorthand, which resets that setting.

In the example, the element defines and consumes its own timeline. Its opacity increases as it passes through the container and decreases when scrolling backward. Local verification of behavior in the target browser is required.

Examples

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

Result

scrollTop 0 → opacity 0.2; scrollTop 150 → opacity 0.6; scrollTop 300 → opacity 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