CSS scroll-driven animations let a web page tie motion to scrolling instead of elapsed time. Firefox 159 enabled the feature by default on October 27, 2026...
CSS Scroll-Driven Animations Reach Every Major Browser: What Firefox 159 Changes
CSS scroll-driven animations let a web page tie motion to scrolling instead of elapsed time. Firefox 159 enabled the feature by default on October 27, 2026, closing the last major browser gap and making this useful CSS approach practical across current versions of the core browsers.
Frankly, this release matters because it changes the default answer to a common web-development question: can we use scroll-based motion without adding a library or writing event-handling code? For many everyday effects, the answer is now yes. The browser can read scroll progress and apply the animation as a CSS timeline, while the page avoids a custom listener that must keep up with every scroll update.
That does not make JavaScript animation tools obsolete. It does mean developers can stop reaching for them automatically. In my code reviews, the cleanest implementation is often the smallest one that still meets the design need. A built-in feature can reduce code and upkeep, but only when the effect is simple enough for CSS and remains usable for people who prefer less motion.
What Are CSS Scroll-Driven Animations?
A standard CSS keyframe animation usually follows a clock. It starts, runs for a set duration, and ends, whether or not the reader has moved down the page. A scroll-driven animation replaces that clock with a timeline linked to scrolling. The animation’s progress can follow a scroll container’s position or an element’s movement through the visible scrollport.
The basic idea is easy to picture. Imagine a reading-progress bar fixed across the top of an article. As the reader moves from the top to the bottom, the bar grows from zero width to full width. With a conventional animation, the bar would need a JavaScript listener to measure scroll position and update its style. With a scroll timeline, CSS can describe the relationship directly. The browser handles the progress as scrolling changes.
There are two anonymous timeline functions to know. The scroll() function tracks the scroll progress of a scroll container along an axis. The view() function tracks a subject element as it enters, crosses, or leaves the scrollport. The first suits a page-level progress marker; the second can link a card or image reveal to that element’s position on screen. MDN’s scroll-driven animations guide explains the timeline model and its CSS properties.
Named timelines provide another option. A developer can declare a scroll timeline with scroll-timeline-name or a view timeline with view-timeline-name, then let descendant elements use that named timeline. This helps when a parent element’s movement should control animation on one or more children. It also makes the relationship easier to read than a set of separate event handlers and calculations.
Here’s the kicker: CSS still needs a keyframe animation to describe what changes. The timeline tells the browser when the animation is at a given point; the keyframes tell it what the start and end states look like. For example, a reveal might move an image upward and change its opacity as it enters view. It is still an animation, just one whose progress follows scrolling instead of a stopwatch.
Mozilla had kept the implementation behind the layout.css.scroll-driven-animations.enabled preference since Firefox 111. Firefox 159 enabled it by default on October 27, 2026. On that same date, MDN classified animation-timeline, scroll(), and view() as Baseline newly available. In plain terms, current releases of the core browsers now support the API. Baseline is a useful compatibility signal, not a promise that every old phone or browser version has the feature.
Core Benefits and Why the Feature Matters
The main benefit is simpler code. When an animation only needs to reflect scroll position, CSS can express that job without a listener, repeated measurements, or manual style changes. That can make a small interaction easier to build and easier for the next developer to understand. Less code is not automatically better, of course, but unused complexity is not a badge of honor either.
- Fewer moving parts: A progress bar or basic reveal can often be written with a timeline and keyframes. There is no custom scroll handler to attach, test, and remove. In a review, I have seen teams spend more time maintaining the listener and its edge cases than building the motion itself.
- A direct fit for reading progress: The animation advances with the document, not with a timer. If a reader stops, the bar stops. If the reader scrolls back, the bar can move backward. That behavior follows the task instead of pretending the page is a video.
- Smooth motion in suitable cases: Scroll-driven animations can run on the compositor thread when the animated properties and browser implementation allow it. Properties such as
transform and opacity are generally better candidates than properties that force layout or repaint work. This can help keep motion smooth when the main thread is busy, but it is not a blanket speed guarantee. - A smaller dependency footprint: A native CSS effect does not require adding a JavaScript animation library just to reveal a few cards. For a team that already tracks bundle size and dependencies, avoiding code that does not earn its keep is a practical win.
- A more declarative relationship: The CSS says what controls the animation. A teammate can inspect the timeline and keyframes rather than hunt through code for scroll calculations, state updates, and cleanup logic.
Let’s be real: the biggest benefit is not that every animation suddenly becomes faster. It is that a routine effect no longer needs a routine chunk of custom code. I have watched teams add a library for one small effect, then keep carrying it years later because removing it felt riskier than leaving it. Native CSS gives teams a sensible option for those small jobs.
The feature also supports better stewardship of engineering time. Time spent fixing a fragile listener is time not spent testing keyboard access, page speed, or content quality. That matters because a website is a tool for people, not a showcase for motion. The responsible choice is the one that serves the reader and respects their needs, including the needs of people who ask for reduced motion.
Still, CSS cannot do every job. If an effect needs pinned sections, scrubbed sequences, callbacks, or coordinated interactions with other application state, a JavaScript tool may be the clearer answer. Use the simpler tool when it fits. Do not force it past its limits.
Step-by-Step: Add a Scroll-Driven Animation
Start with the smallest effect that provides real value. A progress bar or a single element reveal is a better first test than animating every section on a long page. I find that a small example exposes browser, accessibility, and design issues before they get copied across the whole site.
- Choose the right timeline. Use
scroll() when the animation should follow a scroll container’s progress, such as a page reading bar. Use view() when the animation should follow one element as it moves through the scrollport, such as a card that enters view. Decide which axis matters too; block direction is the usual choice for vertical reading, while inline direction can suit horizontal scrolling. - Write the keyframes first. Keep the change clear and modest. For a progress bar, scale from zero to one. For a reveal, use a small translation and opacity change. Prefer
transform and opacity when they produce the intended look, because they are generally better suited to smooth rendering than properties that trigger layout. A dramatic movement is not a substitute for a useful interface. - Attach a timeline. A simple root-page progress bar can use
animation-timeline: scroll(root block). An element reveal can use animation-timeline: view(), with an animation-range to choose which part of the element’s entry or passage drives the effect. If several descendants need to respond to a parent’s scroll or view timeline, define a named timeline on the relevant element and refer to that name from the descendants. - Watch the order of your declarations. The
animation shorthand resets related animation longhands, and animation-timeline is not included in that shorthand. Declare the timeline after the shorthand if you use both. Otherwise, a later shorthand can quietly reset the timeline and leave the animation looking broken. Richi’s dev.to note on scroll-driven animations calls out this easy-to-miss ordering issue; MDN also documents the animation-timeline property. - Account for Firefox’s duration requirement. MDN notes that Firefox needs a non-zero
animation-duration for a scroll-timeline animation to apply, even though the duration does not control how fast the scroll-linked animation runs. A small non-zero duration can satisfy that requirement. Test the actual behavior in the browsers your site supports instead of assuming the value is irrelevant everywhere. - Keep the original behavior as a fallback. Wrap the enhancement in a feature query such as
@supports (animation-timeline: scroll()). If older browsers matter to your audience, leave a reasonable baseline style in place or retain the existing JavaScript behavior for those browsers. Do not make essential information appear only after an animation runs. The content should remain readable if the enhancement does not apply. - Respect reduced-motion settings. Use
@media (prefers-reduced-motion: reduce) to remove or calm nonessential movement. Make sure a reveal does not leave content transparent or hidden when motion is disabled. In one design review, I found that the most important fix was not a fancier timeline; it was setting the content’s default state so every reader could see it before any animation began. - Test the real page, not just a demo. Try slow scrolling, fast scrolling, reverse scrolling, narrow screens, and a long page. Check that the effect does not obscure text or distract from reading. Use browser developer tools to inspect computed styles and look for layout work. A polished sample with one image does not prove that a busy article page will behave well.
For reference, a basic CSS pattern looks like this:
.progress {
position: fixed;
inset: 0 0 auto;
transform: scaleX(0);
transform-origin: left center;
animation-name: grow;
animation-duration: 1ms;
animation-timing-function: linear;
animation-timeline: scroll(root block);
}
@keyframes grow {
to { transform: scaleX(1); }
}
The non-zero duration shown here is a compatibility detail, not a timer for the bar. The scroll timeline sets its progress. The @keyframes block defines the visual change. For a production page, also add reduced-motion handling and a feature-query fallback where your browser support needs it.
Google’s scroll-driven animations codelab gives another hands-on starting point. It is useful for learning the syntax, but adapt examples to your own content and check how they behave with real page length, user settings, and browser support.
Comparison: CSS Scroll-Driven Animations vs. GSAP ScrollTrigger
The closest common competitor is GSAP ScrollTrigger, a JavaScript tool built for scroll-linked animation and interaction. Comparing them as if one must replace the other is the wrong frame. CSS covers many straightforward cases with little code; ScrollTrigger remains useful when the design needs deeper control. In practice, the effect’s requirements should choose the tool, not a blanket rule about native code being good or libraries being bad.
| Need | Native CSS scroll-driven animations | GSAP ScrollTrigger |
|---|
| Basic progress bar | Strong fit; CSS can link a keyframe to scroll progress | Works, but may add more machinery than the effect needs |
| Simple element reveal | Strong fit with view() and animation ranges | Works well and allows more control over timing and sequence |
| Pinning sections | Limited fit for complex pin behavior | A common reason to choose ScrollTrigger |
| Scrubbed, sequenced motion | Suitable for simpler relationships | Better suited to detailed timelines and coordinated sequences |
| Extra library code | No animation-library download for the native effect | GSAP and ScrollTrigger add bundle weight; commentary estimates about 46 KB gzipped when bundled with core GSAP, though actual output depends on setup |
| Browser fallback | Use a feature query and baseline styles | JavaScript can provide behavior where native support is missing |
| Rendering | Can use compositor-friendly properties and browser-managed timelines | Offers broad control; performance depends on the animation and implementation |
The comparison is not a contest with a universal winner. CSS’s value is that simple motion can stay close to the styles that define it. ScrollTrigger’s value is control: pinning, callbacks, scrubbed sequences, and more involved interactions are the sorts of jobs it handles well. The GSAP ScrollTrigger documentation describes its features and setup.
Agency commentary has suggested that native CSS can replace roughly 80 to 90 percent of ScrollTrigger use cases when those cases are basic reveals or progress effects. Treat that number as an estimate, not a measured law. Projects vary, and a site with complex storytelling may use ScrollTrigger for many interactions. I would not remove a library based on a percentage; I would inventory what the project actually uses.
Here’s the practical rule: use CSS when the animation is a direct relationship between scroll progress and a few visual properties. Use a JavaScript library when you need richer control that CSS does not express cleanly. A small dependency is still a dependency, but a complicated home-built animation engine can be worse. Keep the engineering cost visible on both sides of the table.
Common Mistakes to Avoid
The first mistake is treating the Baseline label as permission to ignore compatibility. Baseline newly available means current core browser releases have the feature; it does not promise support on every device your users own. If a site serves old managed browsers, embedded webviews, or long-lived devices, check its actual audience. A small @supports block is cheap insurance when support gaps matter.
The second mistake is putting animation-timeline before a later animation shorthand. Because the shorthand resets related animation properties, the timeline may be cleared. This can look like a browser bug even though the order is the problem. I have seen this kind of CSS failure waste time because the developer inspected the keyframes while the later declaration had already reset the part that connected them to scrolling.
The third mistake is assuming the animation duration controls the scroll-linked speed. It does not serve as a normal clock for a scroll timeline. Firefox’s non-zero duration requirement is a compatibility quirk documented by MDN, not a reason to tune the duration until the animation looks right. The timeline and animation range control the relationship; test those parts directly.
The fourth mistake is animating too much. A page where every heading, card, and image slides in can feel tiring, especially on a long read. A Hacker News discussion around the scroll-driven-animations.style demos included readers who found heavy motion unpleasant. That reaction is worth listening to. Motion should add meaning, not demand attention at every scroll notch.
The fifth mistake is forgetting reduced motion or making content depend on animation. A reveal effect must not hide text from someone whose settings disable movement. Put readable content in the normal state, then add the motion as an enhancement. This is a small act of respect for the person using the page, not an optional polish task.
The sixth mistake is assuming compositor-friendly means free. The browser may keep some animation work off the main thread, particularly when it can animate properties such as transform or opacity. But complex page layout, expensive paint effects, or too many animated elements can still hurt performance. Profile the page. Do not declare victory based on a syntax choice.
Finally, do not migrate away from JavaScript just because CSS now supports the feature. If existing code handles pinning, synchronized sequences, or state changes well, keep it until there is a sound reason to replace it. The goal is a reliable experience with clear ownership, not a lower line count at any cost.
Frequently Asked Questions
What changed in Firefox 159?
Firefox 159 enabled CSS scroll-driven animations by default on October 27, 2026. Mozilla had previously kept the implementation behind a preference beginning in Firefox 111. With the release, Firefox joined current Chrome, Edge, and Safari versions in supporting the feature. MDN marked animation-timeline, scroll(), and view() Baseline newly available on the same date. See the Firefox 159 release notes and MDN’s feature guide for details.
Do scroll-driven animations need JavaScript?
Not for the animation itself when CSS can express the effect. A progress bar can follow a scroll timeline, and an element can respond to a view timeline, without a custom scroll listener or an IntersectionObserver for that motion. JavaScript can still be useful for interactions that involve application state, complex sequencing, or behavior outside CSS’s strengths.
Should I replace GSAP ScrollTrigger with CSS?
Only where the job fits. CSS is a good option for simple progress indicators and element reveals. ScrollTrigger remains a sensible choice for pinning, detailed scrubbed timelines, callbacks, and multi-step motion. Review the project’s actual effects and bundle before deciding. Replacing a useful library with complicated custom code is not an improvement.
How do I support people who prefer less motion?
Use the prefers-reduced-motion media query to remove or reduce nonessential movement. Keep the content visible in its default state, so disabling animation does not make a page incomplete. Test the reduced-motion mode yourself, and consider whether a progress indicator or effect provides enough value to justify motion at all.
Final Thought
Firefox 159 closes a browser-compatibility gap that kept some teams from using scroll-driven animation as ordinary CSS. That is a meaningful change. It makes a progress bar or a restrained reveal easier to write without adding a scroll listener or adopting a library for one small task. The best part is not the novelty. It is the option to use a simpler tool when the job is simple.
I have learned to distrust sweeping migration advice. A feature release does not mean every existing animation should be rewritten, and a native API does not make every page faster by itself. Start with one clear effect, test it in the browsers and settings your readers use, and keep the content useful when the motion is off. That approach is less exciting than a rewrite, but it is much less likely to leave a mess for the next person.
Good engineering is careful work done for real people. Use the CSS timeline when it makes the page clearer, keep JavaScript where it earns its place, and give readers control over motion. That is enough. A small bar that behaves well is better than a grand effect that gets in the way.