CKTIS / CSS
scroll-timeline-name — naming scroll timelines
scroll-timeline-name names scroll progress timelines. animation-timeline connects animations to those timelines.
Version: CSS modules; structured CSSWG indexes reconciled with pinned MDN BCD; Chromium 152 scope gate, per-example verification still required
Syntax
scroll-timeline-name: [ none | <dashed-ident> ]#;scroll-timeline-name declares timeline names on a scroll container. none is the initial value and declares no named timeline. A <dashed-ident> starts with --; # means a comma-separated list, such as --a, --b. The property is neither inherited nor animatable.
scroll-timeline-axis selects the axis; its default is block. Without a scrollable range, the timeline is inactive. Scroll progress, rather than elapsed seconds, drives the animation.
animation-timeline references the name. Place this declaration after the animation shorthand, which resets it. auto fits the duration to the scroll timeline. The example animates a descendant of the container, avoiding reliance on name lookup outside its subtree.
Examples
<!doctype html>
<meta charset="utf-8">
<title>scroll-timeline-name</title>
<style>
.scroller {
height: 160px;
overflow-y: auto;
scroll-timeline-name: --progress;
scroll-timeline-axis: y;
}
.content { height: 640px; }
.bar {
position: sticky;
top: 0;
height: 12px;
background: teal;
transform-origin: left;
animation: grow auto linear both;
animation-timeline: --progress;
}
@keyframes grow {
from { transform: scaleX(0); }
to { transform: scaleX(1); }
}
</style>
<div class="scroller" tabindex="0" aria-label="Scroll progress demo">
<div class="content"><div class="bar"></div></div>
</div>Result
Expected visual result: the teal bar has zero width at scrollTop = 0, half width at scrollTop = 240, and full width at scrollTop = 480.
The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.