Scroll-linked UI is everywhere: sticky headers shrink after a few pixels, progress bars track reading position, cards reveal as they enter the viewport, and table rows can react to their own scroll position. The new CSS scroll-state() function and scroll-driven animation properties make many of these effects possible without a scroll listener. That is great for production UI, but only if the base experience still works when the browser does not support them.

The safest way to ship these features is progressive enhancement: build a readable, interactive layout first, then add scroll behavior where supported. This article walks through a practical pattern using @supports, sensible fallbacks, performance limits, and reduced-motion handling.
What these features do
Scroll-driven animations let CSS tie an animation timeline to a scroll container or the document scroller. Instead of calculating progress in JavaScript, you describe the animation and let the browser update it during scrolling. Common building blocks include animation-timeline: scroll(), view-timeline: --name, animation-range, and timeline-scope.
scroll-state() is a newer CSS condition that lets a selector react to scroll state, such as whether a scroll container can scroll in a direction, is currently scrolled, or has reached an edge. It is especially useful for components like horizontal carousels, shadowed scroll areas, and sticky toolbars where controls or shadows should reflect available overflow.
Browser support changes over time, so do not treat these properties as universal layout dependencies. Check current support tables before shipping, and use feature tests rather than browser-name assumptions.

Start with the no-scroll-script experience
Before adding any scroll magic, ask what the component must do without it. A reading progress bar can simply be absent. A section reveal should show all content. A sticky header can remain static or use position: sticky without the compressed state. A carousel should still scroll normally even if edge shadows and arrow buttons are unavailable.
This matters because scroll-driven effects are usually decoration or feedback, not required content. If your fallback hides content and then JavaScript or CSS reveals it on scroll, unsupported users may get an empty page.
A good baseline has these characteristics:
- Text, controls, and images are visible without animation.
- Scroll containers have usable overflow behavior.
- Focus order remains logical.
- Information is not encoded only by progress or reveal state.
- Core interactions do not depend on animation events.
Use @supports for real feature detection
Do not assume that support for one scroll-animation property means support for the whole feature set. Test the specific syntax you plan to use. For scroll-driven view progress, check the animation-timeline declaration. For scroll-state(), check the function itself.
Example: reading progress bar
First, the fallback keeps the progress bar hidden. The content is completely usable without it.
.reading-progress { display: none; }
Then enhance only supporting browsers:
@supports (animation-timeline: scroll()) {
.reading-progress {
display: block;
position: fixed;
inset: 0 auto auto 0;
width: 100%;
height: 3px;
transform-origin: 0 50%;
animation: reading-progress linear;
animation-timeline: scroll(root block);
}
}
The keyframes only need to scale the bar from zero to full width:
@keyframes reading-progress { from { transform: scaleX(0); } to { transform: scaleX(1); } }
Because transform is composited on a separate visual layer in most browsers, it is usually cheaper than animating width or left. The fixed bar should also have pointer-events: none unless it needs interaction, so it never blocks text selection or taps.
Reveal content without creating a broken hidden state
Scroll reveal effects are where production sites most often get progressive enhancement wrong. A common mistake is setting opacity: 0 globally and adding a view timeline later. If the timeline fails, content stays invisible.
Instead, keep content visible by default and apply the hidden starting state only inside the support block.
.card { /* visible by default */ }
@supports (animation-timeline: view()) {
@media (prefers-reduced-motion: no-preference) {
.card {
animation: card-in linear both;
animation-timeline: view();
animation-range: entry 5% cover 25%;
}
}
}
The keyframes can combine opacity and a small transform:
@keyframes card-in {
from { opacity: 0; transform: translateY(18px); }
to { opacity: 1; transform: none; }
}
Notice the reduced-motion guard. Users who ask for less motion get the cards immediately, with no entrance animation. This is usually better than forcing every interface element to fade in.
Fallback patterns for scroll-state()
scroll-state() is useful for styling scroll containers based on their current scroll condition. For example, a horizontal picker might show a shadow at the left when it has been scrolled and at the right when more content remains.
The fallback should be simple:
- Show no edge shadows.
- Show both shadows if static affordance is acceptable.
- Keep native scrolling and visible controls.
- Do not disable arrows based on unsupported state.
Conceptually, the enhanced rule lives inside a support check for scroll-state(). Exact syntax and supported state keywords may differ by browser, so match the declaration to the specification version you are shipping.
@supports selector(:scroll-state(scrollable-right)) {
/* Enhanced edge shadows or controls go here */
}
Your exact selector may differ depending on the final syntax you target; the production rule is the same: only hide, move, or toggle decorative UI when the browser can actually evaluate the condition.
For a more widely supported fallback, you can use a small scroll listener with requestAnimationFrame throttling to update data attributes such as data-scrolled="true" or data-edge="start". But do not add that JavaScript just to duplicate a CSS feature everywhere. Use it when the state is important enough to justify the extra code, for example in a design-system carousel where disabled arrow buttons affect usability.
Do not break sticky headers
A compressed header is another common use case. The fallback should be a normal sticky header. The enhanced version can animate padding, background, or shadow as the page scrolls. Avoid animating height if you can, because height changes affect document layout. Prefer transform, opacity, background-color, or box-shadow.
If the header contains navigation, make sure the hit targets remain large enough after compression. A tiny 28 px bar may look elegant in a design file but becomes awkward on touch screens. Also verify that anchor scrolling is not obscured by the sticky header; scroll-margin-top on sections is more reliable than magic pixel offsets.
Performance: let the browser do less work
Scroll-driven CSS is not automatically free just because you removed a JavaScript listener. Poor choices can still cause expensive paint work on every frame.
Use these production constraints:
- Animate transform and opacity first. They generally avoid layout and often avoid paint.
- Avoid scroll-tied filter or box-shadow animations on large elements. They can be expensive, especially over long pages.
- Limit animated descendants. Revealing 100 cards with blur is not the same as revealing a small list.
- Keep keyframes simple. A two-state progress bar does not need many stops.
- Test low-end devices. Desktop DevTools smoothness does not predict mobile scroll performance.
- Avoid layout thrash in fallbacks. If using JavaScript, read scroll positions first, write state after, and batch updates in one rAF callback.
For long lists, do not attach a view timeline blindly to every repeated item if the list can grow indefinitely. Consider revealing groups, pagination, or a simpler static treatment. The goal is feedback, not making the browser animate thousands of nodes.
Accessibility checks before shipping
Scroll animation can create motion sickness, distraction, and focus problems. Start with prefers-reduced-motion: reduce. For essential progress feedback, you can keep a non-animated indicator; for decorative entrances, remove the animation entirely.
Pay special attention to keyboard users. If an element starts with opacity: 0 and receives focus before the reveal runs, the browser may scroll a focused but invisible item into view. The safe pattern is to never hide initial content outside the enhanced animation block, and to avoid entrance animations for short pages where most content is already visible.
Also avoid animation-fill-mode patterns that leave content permanently invisible if the timeline does not resolve. Test these scenarios:
- Keyboard tab through the full component.
- Load the page with a hash link deep in the content.
- Use browser find to jump to hidden-looking text.
- Zoom to 200% and verify sticky or fixed UI.
- Turn on reduced motion at the operating system level.
- Disable JavaScript and confirm the CSS-only fallback still reads correctly.
A practical rollout plan
Ship in layers. First, build the static component. Second, add narrow @supports blocks for each feature you actually use. Third, add reduced-motion overrides before decorative keyframes become active. Fourth, test unsupported browsers by disabling the feature in DevTools or forcing the fallback CSS. Finally, measure interaction smoothness on real mobile hardware.
This approach gives you the best of both worlds: modern scroll effects where they are supported, and a dependable interface everywhere else. The CSS platform is taking over work that used to require fragile scroll handlers, but production UI still belongs to the users on older engines, slower devices, and stricter motion preferences.