In short
- Scroll animations are effects that respond to scrolling, such as content fading in as it enters the screen or a progress bar that fills as you read.
- Scroll-triggered animations start when an element comes into view. Scroll-driven animations follow the scroll position itself.
- Both can now be built in CSS, which is smoother and lighter than the JavaScript libraries they used to need.
- Content must never depend on an animation. If the effect fails, everything should still be visible.
- Keep movements small and quick, and switch them off for visitors who prefer reduced motion.
Scroll far enough down almost any modern website and things begin to move: headings rise into place, images fade in, numbers count up, a bar across the top fills as you read. These are scroll animations, and they are one of the most widely used and most widely misused techniques in web design.
Handled with restraint, they give a page rhythm and draw attention to the right things at the right moment. Overdone, they make visitors wait for content that should simply be there. This guide explains the two kinds, how each is built now that CSS can do the job, and the rules that keep them useful.
Two Kinds of Scroll Animation
| Aspect | Scroll-triggered | Scroll-driven |
|---|---|---|
| What happens | An animation plays once when an element enters the screen | The animation's progress is tied directly to the scroll position |
| If you stop scrolling | The animation carries on to the end | The animation stops where it is |
| If you scroll back | Usually nothing | The animation runs in reverse |
| Typical uses | Fade-in and slide-up reveals, counters and staggered lists | Reading progress bars, parallax, and images that scale or move as they pass |
| Built with | A CSS transition started by a small script | CSS scroll-driven animations |
The difference matters because the two feel different. A triggered animation is a brief flourish. A driven animation is under the visitor's control, moving exactly as fast as they scroll, which makes it feel more like part of the page and less like something happening to it.
What Scroll Animations Are For
- Directing attention. Movement draws the eye, so a reveal can point to the thing that matters in a section.
- Showing structure. Elements arriving in sequence show that they are steps, or parts of a group.
- Giving feedback. A progress bar tells a reader how far through a long page they are.
- Telling a story. A product that assembles or changes as you scroll can explain something that a paragraph cannot.
- Adding polish. A small amount of motion makes a site feel finished.
What they are not for is decoration applied to everything. When every heading, paragraph and image on a page animates in, the motion stops meaning anything and simply delays the reading.
Scroll-Driven Animations in CSS
CSS can link any animation to a scroll position instead of to the clock. There are two kinds of timeline. A scroll timeline tracks how far a scrolling area has been scrolled. A view timeline tracks an element's journey through the visible area, from entering at the bottom to leaving at the top.
.progress {
position: fixed;
inset: 0 0 auto 0;
height: 4px;
background: #0b6b5d;
transform-origin: left;
transform: scaleX(0);
}
@keyframes grow {
to { transform: scaleX(1); }
}
@supports (animation-timeline: scroll()) {
.progress {
animation: grow linear both;
animation-timeline: scroll(root);
}
}@keyframes reveal {
from {
opacity: 0;
transform: translateY(1.5rem);
}
}
@supports (animation-timeline: view()) {
@media (prefers-reduced-motion: no-preference) {
.reveal {
animation: reveal linear both;
animation-timeline: view();
animation-range: entry 0% entry 60%;
}
}
}Chrome and Edge have supported scroll-driven animations since 2023 and Safari since version 26, and Firefox enabled them by default in October 2026, so they work in the current version of every major browser. Because many people run older versions, keep the @supports rule: it ensures that anything unsupported shows the content in its finished state. The effect also runs on the compositor, the part of the browser responsible for smooth scrolling, which is why it does not stutter on phones in the way script-driven effects often do. Our guide to parallax scrolling uses the same feature.
Scroll-Triggered Reveals
The classic reveal, where content fades and rises as it comes into view and then stays put, needs to know one thing: when the element has entered the screen. The browser's Intersection Observer does that efficiently, without the cost of listening to every scroll event.
.js .reveal {
opacity: 0;
transform: translateY(1.5rem);
transition: opacity 0.5s ease-out, transform 0.5s ease-out;
}
.js .reveal.is-visible {
opacity: 1;
transform: none;
}
@media (prefers-reduced-motion: reduce) {
.js .reveal {
opacity: 1;
transform: none;
transition: none;
}
}js class, and the movement is removed for visitors who prefer reduced motion.document.documentElement.classList.add("js");
const observer = new IntersectionObserver((entries) => {
for (const entry of entries) {
if (entry.isIntersecting) {
entry.target.classList.add("is-visible");
observer.unobserve(entry.target);
}
}
}, { threshold: 0.15 });
document.querySelectorAll(".reveal").forEach((element) => {
observer.observe(element);
});The detail to copy is the js class. The starting state, invisible, is applied only if JavaScript is running. If the script fails to load, or a search engine reads the page without it, every element is visible. Hiding content in the stylesheet and relying on a script to show it is the commonest way for a scroll animation to break a page.
How Much Motion Is Enough
| Setting | A sensible range | Why |
|---|---|---|
| Distance | A rise of 10 to 30 pixels | Enough to notice. Larger movements look theatrical. |
| Duration | 0.3 to 0.6 seconds | Long enough to register, and short enough not to delay reading |
| Easing | Ease-out | Starts quickly and settles gently, which feels natural |
| Stagger | A small delay between the items in a group | Suggests sequence without making anyone wait |
| Repetition | Once only | Content that animates again every time you scroll past is tiring |
- Animate
opacityandtransformonly. They are cheap for the browser. Animating size or position forces it to recalculate the layout. - Never animate the main heading or the first screen in a way that delays it.
- Reveal sections, not every element inside them.
- Do not bring things in sideways from beyond the edge of a phone screen, which can create a horizontal scroll bar.
Accessibility and Reduced Motion
Motion on a screen can cause real discomfort. People with vestibular disorders may experience dizziness or nausea, and for people who find concentration difficult, constant movement is a distraction. Operating systems provide a reduce motion setting, and the prefers-reduced-motion media query passes it to the page.
The examples above respect it. The general pattern is to write the animation inside a no-preference query, or to cancel it inside a reduce query, so that people who have asked for less motion get a still page with all its content in place. Fades are generally tolerable where large movements are not, but the safest default is none. Our guide to web accessibility covers the standard.
Performance and Search
Scroll animations have a reputation for slowing sites down because they were usually delivered by large JavaScript libraries, loaded on every page to animate a handful of headings. Templates and page builders often still add them that way, one of the trade-offs discussed in our guide to custom websites and website builders. Built with CSS or a few lines of script, they add almost nothing.
- Do not load an animation library for effects that CSS can do.
- Avoid animating the element on the first screen that is measured for Largest Contentful Paint. An element that starts invisible counts as loading late.
- Make sure revealed elements do not push other content around as they appear, which harms layout stability.
- Keep all content in the HTML. Search engines index what is in the page, and text that only exists after an animation runs may be missed.
Our guide to Core Web Vitals explains those measurements.
Common Scroll Animation Mistakes
- Animating everything. If every element moves, none of the movement means anything.
- Hiding content until a script runs. A failed script leaves an empty page.
- Slow, long animations. Visitors scroll faster than the content appears, and see blank space.
- Replaying on every pass. Scrolling back up should not restart the show.
- Scroll hijacking. Taking over the scroll so that a section must be watched is widely disliked.
- Ignoring reduced motion. The setting exists because the effect makes some people ill.
- A heavy library for light work. Most reveals need no library at all.
Putting It Into Practice
Reading about a technique is the easy part. Applying it to a real business, with real content and a launch date, takes judgement about what to use and what to leave out. DigitalPod is a UK-based design and web development studio that designs every site from a blank page and builds it by hand, so a technique is used because it helps the business and not because a template came with it. If you would like a website designer to handle it for you, startup website design is what we specialise in, websites start from £2,400 and our website redesign service brings an older site up to date.
Frequently Asked Questions
What is a scroll animation?
A scroll animation is a visual effect on a web page that responds to scrolling. Common examples are content that fades in as it enters the screen, a progress bar that fills as you read and images that move or scale as they pass.
What is the difference between scroll-triggered and scroll-driven animation?
A scroll-triggered animation starts when an element comes into view and then plays by itself at a fixed speed. A scroll-driven animation is linked to the scroll position, so it advances as you scroll, pauses when you stop and reverses when you scroll back.
Can you do scroll animations with CSS only?
Yes. CSS scroll-driven animations link an ordinary animation to a scroll or view timeline with the animation-timeline property. Current versions of Chrome, Edge, Safari and Firefox all support them. Wrap the rules in @supports so that older browsers simply show the content.
Do scroll animations slow down a website?
Not when they are built with CSS or a small script and limited to opacity and transform. The slowness people associate with them comes from large animation libraries and from effects that run code on every scroll event.
Are scroll animations bad for accessibility?
They can be for people who are sensitive to motion. Respect the reduce motion setting with the prefers-reduced-motion media query, keep movements small, and make sure all content is visible and readable even when no animation runs.