CSS scroll-timeline-name Property

The CSS scroll-timeline-name property defines one or more names for scroll progress timelines that can control CSS animations as an element scrolls.

It allows animations to reference a specific scroll container through the animation-timeline property. The timeline's scrolling axis is determined by scroll-timeline-axis, and both properties can be combined using the scroll-timeline shorthand.

scroll-timeline-name Syntax

The scroll-timeline-name property accepts none or one or more comma-separated timeline names. Each custom name must be a dashed identifier beginning with two hyphens.

Basic Syntax

selector {
  scroll-timeline-name: --timeline-name;
}

Available Syntax

.container {
  scroll-timeline-name: none;
}
.container {
  scroll-timeline-name: --reading-progress;
}
.container {
  scroll-timeline-name: --gallery-progress;
}
.container {
  scroll-timeline-name: --vertical-progress, --horizontal-progress;
}

Multiple Timeline Names

.container {
  scroll-timeline-name: --first, --second, --third;
}

Each name establishes a separate scroll progress timeline on the same element. The corresponding axes are determined by scroll-timeline-axis.

CSS-Wide Keywords

.container {
  scroll-timeline-name: initial;
}
.container {
  scroll-timeline-name: inherit;
}
.container {
  scroll-timeline-name: unset;
}
.container {
  scroll-timeline-name: revert;
}
.container {
  scroll-timeline-name: revert-layer;
}

The property does not accept ordinary identifiers without the -- prefix, lengths, percentages, or quoted strings.

Property Values

Value Description
none Does not establish a named scroll progress timeline for that list entry. This is the initial value.
--custom-name Defines a named scroll progress timeline using a dashed identifier.
initial Resets the property to none.
inherit Uses the computed timeline name list from the parent element.
unset Resets the property to none because it is not inherited.
revert Reverts the property according to CSS cascade origin rules.
revert-layer Reverts the property according to CSS cascade layer rules.

Property Characteristics

Characteristic Value
Initial value none
Inherited No
Applies to All elements
Computed value List of specified keywords and identifiers
Animation type Discrete
Percentages Not applicable
Shorthand property scroll-timeline
Related longhand scroll-timeline-axis

Valid Values

.container {
  scroll-timeline-name: none;
}
.container {
  scroll-timeline-name: --progress;
}
.container {
  scroll-timeline-name: --article-progress;
}
.container {
  scroll-timeline-name: --gallery-scroll;
}
.container {
  scroll-timeline-name: --one, --two;
}
.container {
  scroll-timeline-name: --vertical, --horizontal;
}

Invalid Values

.container {
  scroll-timeline-name: progress;
}
.container {
  scroll-timeline-name: "progress";
}
.container {
  scroll-timeline-name: 50%;
}
.container {
  scroll-timeline-name: --first --second;
}
.container {
  scroll-timeline-name: auto;
}
.container {
  scroll-timeline-name: scroll();
}

Timeline names must be dashed identifiers. Use commas to separate multiple names. The scroll() function creates an anonymous timeline through animation-timeline and is not a valid scroll-timeline-name value.

How It Works

The scroll-timeline-name property assigns an identifier to a scroll progress timeline established by an element. Animations can reference that identifier to follow the element's scrolling progress.

Step 1: Create a Scroll Container

.scroll-container {
  height: 300px;
  overflow-y: auto;
}

The container must have a scrollable range along the selected axis for the timeline to provide active progress.

Step 2: Define a Timeline Name

.scroll-container {
  scroll-timeline-name: --reading-progress;
}

This establishes a named scroll progress timeline on the container.

Step 3: Select the Scrolling Axis

.scroll-container {
  scroll-timeline-axis: block;
}

The block value follows the logical block axis, which is vertical in horizontal writing modes.

Step 4: Define an Animation

@keyframes fill-progress {
  from {
    transform: scaleX(0);
  }
  to {
    transform: scaleX(1);
  }
}

Step 5: Connect the Animation

.scroll-container .progress-bar {
  transform-origin: left;
  animation: fill-progress linear both;
  animation-timeline: --reading-progress;
}

The progress bar responds to scrolling because its animation references the named timeline.

Timeline Progress

For a typical scroll container, timeline progress starts at 0% at the beginning of the scrollable range and reaches 100% at the end.

Scrolling Backward

Scrolling toward the beginning decreases timeline progress, allowing the animation to reverse without additional JavaScript.

No Automatic Animation

Defining a timeline name does not animate an element by itself. An animation must reference the name through animation-timeline.

Inactive Timelines

If the selected scrolling axis has no scrollable range, the timeline is inactive and animations attached to it cannot progress normally.

Timeline Naming Rules

Named scroll progress timelines use CSS dashed identifiers, also known as <dashed-ident> values.

Required Prefix

.container {
  scroll-timeline-name: --reading-progress;
}

The two leading hyphens distinguish the timeline name from ordinary CSS keywords.

Descriptive Names

.article {
  scroll-timeline-name: --article-progress;
}
.gallery {
  scroll-timeline-name: --gallery-progress;
}
.sidebar {
  scroll-timeline-name: --sidebar-scroll;
}

Descriptive names make it easier to identify which scroll container controls an animation.

Case Sensitivity

.container {
  scroll-timeline-name: --PageProgress;
}
.container .indicator {
  animation-timeline: --pageprogress;
}

These identifiers do not match because custom identifiers are case-sensitive.

Names Are Not CSS Custom Properties

Although timeline names and CSS custom properties both use the -- prefix, they serve different purposes.

.container {
  --accent-color: #2563eb;
  scroll-timeline-name: --reading-progress;
}

The first declaration defines a CSS custom property. The second defines a scroll timeline name.

Using the Name in an Animation

.container .indicator {
  animation: fill-progress linear both;
  animation-timeline: --reading-progress;
}

The timeline name is referenced directly, without var().

Avoid Duplicate Names

Use distinct names when multiple scroll containers should control independent animations. Reusing the same name in overlapping timeline scopes can make timeline resolution harder to understand.

Important Consideration

A timeline name identifies the timeline. It does not determine the scrolling direction, animation keyframes, or animation duration.

Multiple Named Timelines

A single element can define multiple named scroll progress timelines by separating their names with commas.

Two Timeline Names

.container {
  scroll-timeline-name: --vertical-progress, --horizontal-progress;
}

Assigning Different Axes

.container {
  scroll-timeline-name: --vertical-progress, --horizontal-progress;
  scroll-timeline-axis: block, inline;
}

The first timeline uses the block axis, while the second uses the inline axis.

Physical Scrolling Axes

.container {
  scroll-timeline-name: --horizontal, --vertical;
  scroll-timeline-axis: x, y;
}

The timelines track horizontal and vertical scrolling independently.

Referencing Each Timeline

.container .horizontal-indicator {
  animation: fill-horizontal linear both;
  animation-timeline: --horizontal;
}
.container .vertical-indicator {
  animation: fill-vertical linear both;
  animation-timeline: --vertical;
}

Matching List Positions

The timeline name list and axis list are matched by position. If the axis list contains fewer values, its values repeat as needed to match the names.

One Axis for Multiple Names

.container {
  scroll-timeline-name: --first, --second;
  scroll-timeline-axis: block;
}

Both timelines use the block axis.

Using none in a List

.container {
  scroll-timeline-name: --first, none, --third;
  scroll-timeline-axis: block, inline, x;
}

The none entry does not establish a named timeline. The other entries define timelines using their corresponding axes.

Important Consideration

Keep the name and axis lists in a predictable order to make their relationships easier to maintain.

Selecting Scrolling Axes

The scroll-timeline-axis property determines which scrolling direction controls each named timeline.

Axis Description
block Tracks scrolling along the logical block axis. This is the default.
inline Tracks scrolling along the logical inline axis.
x Tracks physical horizontal scrolling.
y Tracks physical vertical scrolling.

Block-Axis Timeline

.container {
  scroll-timeline-name: --progress;
  scroll-timeline-axis: block;
}

In horizontal writing, the block axis is vertical.

Inline-Axis Timeline

.container {
  scroll-timeline-name: --progress;
  scroll-timeline-axis: inline;
}

In horizontal writing, the inline axis is horizontal.

Horizontal Timeline

.container {
  scroll-timeline-name: --progress;
  scroll-timeline-axis: x;
}

Vertical Timeline

.container {
  scroll-timeline-name: --progress;
  scroll-timeline-axis: y;
}

Writing Mode Comparison

Writing Mode Block Axis Inline Axis
horizontal-tb Vertical Horizontal
vertical-rl Horizontal Vertical
vertical-lr Horizontal Vertical

Important Consideration

Use logical axes when the timeline should adapt to writing modes. Use physical axes when the scrolling direction must remain horizontal or vertical.

Using the scroll-timeline Shorthand

The scroll-timeline shorthand combines scroll-timeline-name and scroll-timeline-axis into one declaration.

Longhand Declarations

.container {
  scroll-timeline-name: --reading-progress;
  scroll-timeline-axis: block;
}

Equivalent Shorthand

.container {
  scroll-timeline: --reading-progress block;
}

Omitting the Axis

.container {
  scroll-timeline: --reading-progress;
}

The omitted axis defaults to block.

Multiple Named Timelines

.container {
  scroll-timeline: --vertical block, --horizontal inline;
}

Resetting the Name

.container {
  scroll-timeline-name: --reading-progress;
  scroll-timeline: none;
}

The final shorthand resets the timeline name to none and the axis to block.

Overriding the Shorthand Name

.container {
  scroll-timeline: --first block;
  scroll-timeline-name: --second;
}

The later longhand changes the timeline name to --second while retaining the block axis.

Important Consideration

Use the shorthand for concise timeline definitions. Use the longhand properties when timeline names and axes need to be managed separately.

Connecting Animations

The animation-timeline property connects a CSS animation to a named scroll progress timeline.

Define the Timeline

.scroll-container {
  scroll-timeline-name: --reading-progress;
  scroll-timeline-axis: block;
}

Define the Keyframes

@keyframes grow-progress {
  from {
    transform: scaleX(0);
  }
  to {
    transform: scaleX(1);
  }
}

Attach the Animation

.scroll-container .progress-bar {
  transform-origin: left;
  animation: grow-progress linear both;
  animation-timeline: --reading-progress;
}

The animation progresses according to the named timeline's scroll position.

Declaration Order Matters

.progress-bar {
  animation-timeline: --reading-progress;
  animation: grow-progress linear both;
}

This order is incorrect because the later animation shorthand resets animation-timeline to auto.

Correct Declaration Order

.progress-bar {
  animation: grow-progress linear both;
  animation-timeline: --reading-progress;
}

Changing the Timeline Name

.scroll-container {
  scroll-timeline-name: --new-progress;
}
.scroll-container .progress-bar {
  animation-timeline: --new-progress;
}

Both declarations must reference the same name.

Multiple Animations

.element {
  animation: fade-in linear both, move-up linear both;
  animation-timeline: --reading-progress, --reading-progress;
}

Both animations can follow the same named scroll progress timeline.

Important Consideration

The timeline name connects the animation to a scroll progress source. Keyframes determine the visual changes, while the scrolling axis determines how progress is measured.

Timeline Scope and Visibility

Named scroll timelines follow CSS timeline lookup rules. An animation must be able to resolve the timeline name from its position in the document.

Timeline Defined on an Ancestor

.scroll-container {
  overflow-y: auto;
  scroll-timeline-name: --progress;
}
.scroll-container .progress-bar {
  animation: grow-progress linear both;
  animation-timeline: --progress;
}

The progress bar can reference the timeline because it is a descendant of the element defining it.

Timeline Defined on a Sibling

.scroll-container {
  scroll-timeline-name: --progress;
}
.progress-bar {
  animation: grow-progress linear both;
  animation-timeline: --progress;
}

If the two elements are siblings, the progress bar cannot automatically resolve the timeline defined on the scroll container.

Using timeline-scope

.demo-wrapper {
  timeline-scope: --progress;
}
.scroll-container {
  overflow-y: auto;
  scroll-timeline-name: --progress;
}
.progress-bar {
  animation: grow-progress linear both;
  animation-timeline: --progress;
}

When both elements are descendants of .demo-wrapper, timeline-scope can extend the named timeline's visibility across the shared subtree.

Multiple Scoped Timelines

.demo-wrapper {
  timeline-scope: --article-progress, --gallery-progress;
}

Multiple names can be declared when different animations need access to separate timelines.

Name Conflicts

When more than one timeline uses the same name, CSS timeline lookup rules determine which definition is used. Prefer distinct names when the timelines serve different purposes.

Important Consideration

When an animation does not respond to scrolling, check that the timeline name matches and that the animation target can resolve the timeline.

Scroll Timelines vs. View Timelines

Scroll progress timelines and view progress timelines are both used for scroll-driven animations, but they measure different types of progress.

Feature Scroll Timeline View Timeline
Timeline naming property scroll-timeline-name view-timeline-name
Progress source Scroll position within a scroll container Visibility of a subject within a scrollport
Typical use Reading progress indicators Reveal effects as elements enter the visible area
Anonymous timeline function scroll() view()

Named Scroll Timeline

.container {
  scroll-timeline-name: --page-progress;
}

Named View Timeline

.section {
  view-timeline-name: --section-visibility;
}

Anonymous Scroll Timeline

.progress-bar {
  animation: grow-progress linear both;
  animation-timeline: scroll();
}

The scroll() function creates an anonymous scroll progress timeline without requiring a named timeline declaration.

Anonymous View Timeline

.section {
  animation: reveal linear both;
  animation-timeline: view();
}

The view() function creates an anonymous view progress timeline based on the animated element's visibility.

Choosing a Timeline

Use a scroll timeline when animation progress should follow the overall scrolling position. Use a view timeline when progress should depend on an element entering, crossing, or leaving a visible region.

Practical Examples

Article Reading Progress

.article-scroll {
  height: 400px;
  overflow-y: auto;
  scroll-timeline-name: --article-progress;
  scroll-timeline-axis: block;
}
.article-scroll .progress-bar {
  transform-origin: left;
  animation: fill-progress linear both;
  animation-timeline: --article-progress;
}
@keyframes fill-progress {
  from {
    transform: scaleX(0);
  }
  to {
    transform: scaleX(1);
  }
}

The progress indicator grows as the article container scrolls.

Horizontal Gallery Progress

.gallery {
  display: flex;
  overflow-x: auto;
  scroll-timeline-name: --gallery-progress;
  scroll-timeline-axis: x;
}
.gallery .indicator {
  animation: fill-progress linear both;
  animation-timeline: --gallery-progress;
}

The timeline follows horizontal gallery scrolling.

Color Transition

.scroll-panel {
  overflow-y: auto;
  scroll-timeline-name: --color-progress;
}
.scroll-panel .color-box {
  animation: change-color linear both;
  animation-timeline: --color-progress;
}
@keyframes change-color {
  from {
    background-color: #dbeafe;
  }
  to {
    background-color: #2563eb;
  }
}

The color changes according to scroll progress.

Rotating Graphic

.scroll-panel {
  scroll-timeline-name: --rotation-progress;
}
.scroll-panel .graphic {
  animation: rotate-graphic linear both;
  animation-timeline: --rotation-progress;
}
@keyframes rotate-graphic {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

The graphic rotates as the scroll position advances.

Two-Dimensional Scroll Area

.scroll-grid {
  width: 400px;
  height: 300px;
  overflow: auto;
  scroll-timeline-name: --horizontal-progress, --vertical-progress;
  scroll-timeline-axis: x, y;
}

The element defines separate timelines for horizontal and vertical scrolling.

Removing a Named Timeline

.scroll-container {
  scroll-timeline-name: none;
}

The element no longer establishes the previously named timeline through this property.

scroll-timeline-name Example

This interactive example defines a named scroll progress timeline called --demo-reading-progress. Two animations reference the same timeline: a progress bar grows and a square rotates as the container scrolls.

HTML Example

<div class="scroll-name-demo">
  <div class="scroll-area">
    <div class="progress-track">
      <div class="progress-bar"></div>
    </div>
    <div class="content">
      <h3>Named Scroll Timeline</h3>
      <p>Scroll down to begin.</p>
      <div class="animated-square"></div>
      <p>The progress bar follows the timeline.</p>
      <p>The square uses the same timeline.</p>
      <p>Scrolling backward reverses both effects.</p>
      <p>Continue scrolling toward the end.</p>
      <p>End of the scrollable content.</p>
    </div>
  </div>
</div>

CSS Example

.scroll-name-demo .scroll-area {
  position: relative;
  height: 220px;
  overflow-y: auto;
  border: 1px solid #cbd5e1;
  scroll-timeline-name: --demo-reading-progress;
  scroll-timeline-axis: block;
}
.scroll-name-demo .progress-track {
  position: sticky;
  top: 0;
  height: 8px;
  background-color: #e2e8f0;
  z-index: 1;
}
.scroll-name-demo .progress-bar {
  width: 100%;
  height: 100%;
  background-color: #2563eb;
  transform-origin: left;
  animation: demo-fill linear both;
  animation-timeline: --demo-reading-progress;
}
.scroll-name-demo .content {
  padding: 20px;
}
.scroll-name-demo .content p {
  margin-bottom: 35px;
}
.scroll-name-demo .animated-square {
  width: 50px;
  height: 50px;
  background-color: #2563eb;
  animation: demo-rotate linear both;
  animation-timeline: --demo-reading-progress;
}
@keyframes demo-fill {
  from {
    transform: scaleX(0);
  }
  to {
    transform: scaleX(1);
  }
}
@keyframes demo-rotate {
  from {
    transform: rotate(0deg);
    background-color: #2563eb;
  }
  to {
    transform: rotate(360deg);
    background-color: #16a34a;
  }
}
Browser Result

Named Scroll Timeline

Scroll down to begin.

The progress bar follows the timeline.

The square uses the same timeline.

Scrolling backward reverses both effects.

Continue scrolling toward the end.

End of the scrollable content.

Scroll inside the example. In supporting browsers, the progress bar fills and the square rotates and changes color. Both effects are controlled by the same named scroll timeline.

Changing the Timeline Name

.scroll-name-demo .scroll-area {
  scroll-timeline-name: --new-progress;
}
.scroll-name-demo .progress-bar,
.scroll-name-demo .animated-square {
  animation-timeline: --new-progress;
}

The animations continue working when the timeline definition and references use the same new name.

Using the Shorthand

.scroll-name-demo .scroll-area {
  scroll-timeline: --demo-reading-progress block;
}

This declaration is equivalent to setting the name and axis separately.

Removing the Timeline Name

.scroll-name-demo .scroll-area {
  scroll-timeline-name: none;
}

The named timeline is removed, so animations referencing it no longer receive scroll progress.

Reduced Motion

The live example disables decorative animations when the user requests reduced motion. The content remains scrollable.

Browser Compatibility Note

Browsers without named scroll-driven animation support may display the content without the animated effects.

Accessibility Considerations

Named scroll timelines can improve visual feedback, but animations should remain optional enhancements.

Respect Reduced Motion Preferences

@media (prefers-reduced-motion: reduce) {
  .decorative-animation {
    animation: none;
  }
}

Disable or simplify decorative animations when reduced motion is preferred.

Keep Content Available

Do not make important information accessible only after an animation reaches a particular scroll position.

Maintain Keyboard Scrolling

Custom scroll regions should remain accessible through keyboard navigation.

Use Accessible Labels

Give independent scrolling regions meaningful accessible names when their purpose is not clear from surrounding content.

Avoid Excessive Movement

Large rotations, scaling effects, and rapid visual changes may distract users while scrolling.

Provide Fallbacks

Essential content and controls should remain usable when scroll-driven animations are unsupported or disabled.

Test Multiple Input Methods

Verify behavior with mouse wheels, touchscreens, trackpads, and keyboard scrolling.

Common Mistakes

Omitting the Required Prefix

.container {
  scroll-timeline-name: reading-progress;
}

Use a dashed identifier such as --reading-progress.

Using a Quoted String

.container {
  scroll-timeline-name: "--reading-progress";
}

Timeline names are identifiers, not strings.

Using Space-Separated Names

.container {
  scroll-timeline-name: --first --second;
}

Use commas to separate multiple timeline names.

Mismatching Timeline Names

.container {
  scroll-timeline-name: --article-progress;
}
.container .indicator {
  animation-timeline: --page-progress;
}

The names do not match, so the animation cannot use the intended timeline.

Ignoring Case Sensitivity

--PageProgress and --pageprogress are different identifiers.

Using var() to Reference a Timeline

A timeline name is not a CSS custom property. Reference the name directly through animation-timeline.

Forgetting the Scrollable Range

A named timeline requires a usable scrolling range along its selected axis to provide active progress.

Using the Wrong Axis

A timeline following the inline axis will not progress if the container only scrolls along its block axis.

Overwriting animation-timeline

.indicator {
  animation-timeline: --reading-progress;
  animation: fill-progress linear both;
}

The later animation shorthand resets the timeline association. Place animation-timeline afterward.

Ignoring Timeline Scope

An animation must be able to resolve the named timeline through CSS timeline lookup rules.

Confusing Scroll and View Timelines

scroll-timeline-name defines scroll progress timeline names. view-timeline-name defines view progress timeline names.

Important Considerations

Keep the following points in mind when using scroll-timeline-name:

  • It defines names for scroll progress timelines.
  • Its initial value is none, and it is not inherited.
  • Custom timeline names must begin with two hyphens.
  • Timeline names are case-sensitive identifiers.
  • Timeline names are not CSS custom properties.
  • Multiple names can be declared using comma-separated lists.
  • Each named timeline can use a corresponding scrolling axis.
  • The default axis is block.
  • The property is a longhand of scroll-timeline.
  • The property does not create scrolling or change layout.
  • A usable scrollable range is required for active timeline progress.
  • Timeline progress changes as the scroll position changes.
  • Scrolling backward decreases timeline progress.
  • Animations reference named timelines through animation-timeline.
  • Declare animation-timeline after the animation shorthand.
  • Named timelines follow CSS timeline lookup and scoping rules.
  • timeline-scope can extend timeline visibility across a shared subtree.
  • Use distinct names for independent timelines when practical.
  • Scroll progress timelines differ from view progress timelines.
  • Provide fallbacks for browsers without scroll-driven animation support.
  • Respect reduced-motion preferences for decorative effects.

Browser Support

The CSS scroll-timeline-name property has limited availability across browsers. It belongs to the newer CSS Scroll-Driven Animations features and is not supported as consistently as traditional CSS animation properties.

Modern Chromium-based browsers support named scroll-driven animation timelines. Support in Firefox and Safari may vary by browser version or feature availability.

For current compatibility information, visit Can I Use? and search for scroll-timeline-name.

Use progressive enhancement so essential content remains available when the property is unsupported.

Feature Detection

@supports (scroll-timeline-name: --progress) and (animation-timeline: --progress) {
  .scroll-container {
    scroll-timeline-name: --progress;
    scroll-timeline-axis: block;
  }
  .progress-bar {
    animation: fill-progress linear both;
    animation-timeline: --progress;
  }
}

Feature queries help apply named scroll-driven animation styles only when the required declarations are recognized.

Specifications

The scroll-timeline-name property is defined in the CSS Scroll-Driven Animations specification.

CSS Scroll-Driven Animations Level 1

The specification defines how named scroll progress timelines are established and referenced by scroll-driven animations.

For additional documentation and examples, consult MDN Web Docs.

MDN Web Docs: scroll-timeline-name