view-timeline CSS property

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

The view-timeline CSS shorthand property defines a named view progress timeline's name, direction, and inset values.

Constituent properties

This property is a shorthand for the following CSS properties:

Syntax

css
/* One component */
view-timeline: none;
view-timeline: --custom_name_for_timeline;

/* Two components */
view-timeline: --custom_name_for_timeline block;
view-timeline: --custom_name_for_timeline y;
view-timeline: none inline;
view-timeline: none x;

/* Three components */
view-timeline: --custom_name_for_timeline block auto;
view-timeline: --custom_name_for_timeline block 20% 200px;

/* Global values */
view-timeline: inherit;
view-timeline: initial;
view-timeline: revert;
view-timeline: revert-layer;
view-timeline: unset;

Values

<view-timeline-name>

See view-timeline-name. The default value is none.

<view-timeline-inset>

See view-timeline-inset. The default value is auto.

<view-timeline-axis>

See view-timeline-axis. The default value is block.

Description

The view-timeline shorthand property defines a named view progress timeline, which progresses based on changes to the visibility of an element (the subject) within a scrollable element (scroller). The view-timeline property is set on the subject. If the scroller element does not overflow its container in the axis dimension or if the overflow is hidden or clipped, no scroll progress timeline will be created.

The subject's visibility inside the scroller is tracked — by default, the timeline is at 0% when the subject is first visible at one edge of the scroller and 100% when it reaches the opposite edge.

The view-timeline can contain three constituent values: a name for the named view progress timeline, a scroll axis value, and up to two timeline inset values. If only one value is declared, the value is the view-timeline-name. The name is then referenced in an animation-timeline declaration to indicate the element that will be animated as the timeline progresses. This can be the subject element, but it doesn't have to be — you can animate a different element as the subject moves through the scrolling area.

The view-timeline shorthand property can be applied to a container element to set a combination of the <view-timeline-name>, <view-timeline-inset>, and <view-timeline-axis> values. At least one value must be specified. If all values are specified, the order must be <view-timeline-name> followed by <view-timeline-axis> and/or <view-timeline-inset>.

The names specified in the <view-timeline-name> component must be a list of comma-separated <dashed-ident> values (which means they must start with --) or the keyword none.

Formal definition

Initial valueas each of the properties of the shorthand:
Applies toall elements
Inheritedno
Computed valueas each of the properties of the shorthand:
Animation typeas each of the properties of the shorthand:

Formal syntax

view-timeline = 
[ <'view-timeline-name'> [ <'view-timeline-axis'> || <'view-timeline-inset'> ]? ]#

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

<view-timeline-axis> =
[ block | inline | x | y ]#

<view-timeline-inset> =
[ [ auto | <length-percentage> ]{1,2} ]#

<length-percentage> =
<length> |
<percentage>

Examples

Creating a named view progress timeline

A view progress timeline named --subject-reveal is defined using the view-timeline property on a subject element with a class of animation. This is then set as the timeline for the same element using animation-timeline: --subject-reveal. The result is that the subject element animates as it moves upwards through the document as it is scrolled.

HTML

The HTML for the example is shown below.

html
<div class="content">
  <h1>Content</h1>

  <p>
    Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
    tempor incididunt ut labore et dolore magna aliqua. Risus quis varius quam
    quisque id. Et ligula ullamcorper malesuada proin libero nunc consequat
    interdum varius. Elit ullamcorper dignissim cras tincidunt lobortis feugiat
    vivamus at augue.
  </p>

  <p>
    Dolor sed viverra ipsum nunc aliquet. Sed sed risus pretium quam vulputate
    dignissim. Tortor aliquam nulla facilisi cras. A erat nam at lectus urna
    duis convallis convallis. Nibh ipsum consequat nisl vel pretium lectus.
    Sagittis aliquam malesuada bibendum arcu vitae elementum. Malesuada bibendum
    arcu vitae elementum curabitur vitae nunc sed velit.
  </p>

  <div class="subject animation"></div>

  <p>
    Adipiscing enim eu turpis egestas pretium aenean pharetra magna ac. Arcu
    cursus vitae congue mauris rhoncus aenean vel. Sit amet cursus sit amet
    dictum. Augue neque gravida in fermentum et. Gravida rutrum quisque non
    tellus orci ac auctor augue mauris. Risus quis varius quam quisque id diam
    vel quam elementum. Nibh praesent tristique magna sit amet purus gravida
    quis. Duis ultricies lacus sed turpis tincidunt id aliquet. In egestas erat
    imperdiet sed euismod nisi. Eget egestas purus viverra accumsan in nisl nisi
    scelerisque. Netus et malesuada fames ac.
  </p>
</div>

CSS

The subject element and its containing content element are styled minimally, and the text content is given some basic font settings:

css
.subject {
  width: 300px;
  height: 200px;
  margin: 0 auto;
  background-color: deeppink;
}

.content {
  width: 75%;
  max-width: 800px;
  margin: 0 auto;
}

p,
h1 {
  font-family: "Helvetica", "Arial", sans-serif;
}

h1 {
  font-size: 3rem;
}

p {
  font-size: 1.5rem;
  line-height: 1.5;
}

The <div> with the class of subject is also given a class of animation — this is where view-timeline is set to define a named view progress timeline. It is also given an animation-timeline name with the same value to declare that this will be the element animated as the view progress timeline progresses.

Lastly, an animation is specified on the element that animates its opacity and scale, causing it to fade in and grow as it moves up the scroller.

css
.animation {
  view-timeline: --subject-reveal block;
  animation-timeline: --subject-reveal;

  animation-name: appear;
  animation-fill-mode: both;
  animation-duration: 1ms; /* Firefox requires this to apply the animation */
}

@keyframes appear {
  from {
    opacity: 0;
    transform: scaleX(0);
  }

  to {
    opacity: 1;
    transform: scaleX(1);
  }
}

Result

Scroll to see the subject element being animated.

Specifications

Specification
Scroll-driven Animations
# view-timeline-shorthand

Browser compatibility

desktop mobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
view-timeline
Chrome – Full support
Chrome 115 (Release date: 2023-07-18)
footnote Full support
Edge – Full support
Edge 115 (Release date: 2023-07-21)
footnote Full support
Firefox – No support
Firefox 114 (Release date: 2023-06-06)
footnote , disabled
disabled From version 114 users must explicitly set the layout.css.scroll-driven-animations.enabled preference to true. To change preferences in Firefox, visit about:config.
footnote Now supports the x and y values, and also the deprecated horizontal and vertical values.
Opera – Full support
Opera 101 (Release date: 2023-07-26)
footnote Full support
Safari – Full support
Safari 26 (Release date: 2025-09-15)
footnote Full support
Chrome Android – Full support
Chrome Android 115 (Release date: 2023-07-21)
footnote Full support
Firefox for Android – No support
Firefox for Android
footnote No support
Opera Android – Full support
Opera Android 77 (Release date: 2023-08-31)
footnote Full support
Safari on iOS – Full support
Safari on iOS 26 (Release date: 2025-09-15)
footnote Full support
Samsung Internet – Full support
Samsung Internet 23 (Release date: 2023-10-18)
footnote Full support
WebView Android – Full support
WebView Android 115 (Release date: 2023-07-21)
footnote Full support
WebView on iOS – Full support
WebView on iOS 26 (Release date: 2025-09-15)
footnote Full support
none
Chrome – Full support
Chrome 115 (Release date: 2023-07-18)
footnote Full support
Edge – Full support
Edge 115 (Release date: 2023-07-21)
footnote Full support
Firefox – No support
Firefox
footnote No support
Opera – Full support
Opera 101 (Release date: 2023-07-26)
footnote Full support
Safari – Full support
Safari 26 (Release date: 2025-09-15)
footnote Full support
Chrome Android – Full support
Chrome Android 115 (Release date: 2023-07-21)
footnote Full support
Firefox for Android – No support
Firefox for Android
footnote No support
Opera Android – Full support
Opera Android 77 (Release date: 2023-08-31)
footnote Full support
Safari on iOS – Full support
Safari on iOS 26 (Release date: 2025-09-15)
footnote Full support
Samsung Internet – Full support
Samsung Internet 23 (Release date: 2023-10-18)
footnote Full support
WebView Android – Full support
WebView Android 115 (Release date: 2023-07-21)
footnote Full support
WebView on iOS – Full support
WebView on iOS 26 (Release date: 2025-09-15)
footnote Full support

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
No support
No support
See implementation notes.
User must explicitly enable this feature.

See also