Contents
Firefox 159, released on October 27, 2026, enables CSS scroll-driven animations by default. They are now available in the latest stable versions of all major browsers, making it easier to implement reading progress bars and image reveal effects without JavaScript scroll handlers.
Key Points#
- CSS scroll-driven animations tie animation progress directly to scrolling, so scrolling backward reverses the effect.
- Use
scroll()to track a scroll container andview()to track an element as it passes through the visible area. - Supported in Chrome 115, Edge 115, Safari 26, Firefox 159, and later.
- Keep content readable without animations and respect users’ reduced-motion preferences.
What Changes for Developers#
Regular CSS animations progress over time. Scroll-driven animations progress according to scroll position: they stop when scrolling stops and reverse when scrolling backward.
This differs from effects that start when an element enters the screen and play for a set duration. Choose scroll-driven animations when you want the visual state to indicate the reader’s current position, such as a progress bar that reaches 50% halfway through a page’s scrollable range.
This approach can also reduce the load on the main thread. Suitable animations can run off the main thread, making it easier to maintain smooth motion even when JavaScript is busy. However, this is not guaranteed for every effect. The properties being animated and the browser’s implementation also affect performance.
Choose the Right Timeline#
The animation-timeline property connects an animation defined with @keyframes to the basis for its progress. These two functions cover common use cases.
scroll()measures progress through a scroll container’s scrollable range.view()measures an element’s passage through the visible area of its nearest scroll container.
Use scroll(block root) for a page-wide progress bar. The root argument selects the page’s root scroll container, and block selects the block axis. On pages with horizontal writing, this is usually vertical. In contrast, scroll() without arguments uses the nearest ancestor scroll container.
Use view() for effects tied to individual elements, such as an image gradually appearing as it enters the viewport. Its progress reflects the element’s passage through the visible area, rather than the reader’s position on the page as a whole.
Add a Reading Progress Bar#
Place the following element on a page long enough to scroll, then add the CSS. The bar grows from the left edge and reaches full width at the end of the scrollable range.
<div id="progress" aria-hidden="true"></div>
<style>
#progress {
display: none;
}
@keyframes grow-progress {
from { transform: scaleX(0); }
to { transform: scaleX(1); }
}
@supports (animation-timeline: scroll(block root)) {
@media (prefers-reduced-motion: no-preference) {
#progress {
display: block;
position: fixed;
top: 0;
left: 0;
z-index: 1000;
width: 100%;
height: 4px;
background: #06c;
transform-origin: left;
animation-name: grow-progress;
animation-duration: auto;
animation-timing-function: linear;
animation-timeline: scroll(block root);
}
}
}
</style>scaleX() changes the bar’s apparent width without altering the document’s layout. The linear timing function keeps the bar’s length proportional to scroll progress. Since the bar is decorative, aria-hidden="true" excludes it from the accessibility tree.
Hiding it by default is also important. If the browser does not support the timeline or the user prefers reduced motion, the bar remains hidden.
Check Support and Accessibility#
According to the supplied MDN compatibility data, the underlying animation-timeline, scroll-timeline, and view-timeline properties are supported in Chrome 115, Edge 115, Safari 26, Firefox 159, and later. With Firefox’s release, this feature became Baseline Newly Available, making it available across the browsers covered by Baseline. Older browsers and embedded WebViews still need consideration.
Treat animations as enhancements. Keep text and images accessible even when effects are disabled or unsupported. In particular, ensure that important content does not remain transparent when falling back.
Before publishing, check these four points.
- Scroll forward and backward to confirm that the animation correctly follows the scroll position.
- Enable reduced motion and confirm that the page remains usable.
- Disable the animation rules to test the fallback.
- Check scrolling on mobile devices, especially when animating properties other than transform or opacity.
Next Steps#
Add the progress bar above to a long article page, then confirm in Firefox 159 that it reaches full width when you reach the bottom of the page.
Source: https://gihyo.jp/article/2026/10/css-scroll-driven-animations
Contents
