scroll-state()
CSS-Tricks · Nov 19, 2026
The CSS scroll-state() media query lets developers apply different styles based on how a user is scrolling, without writing JavaScript. It works like other media features, letting you target scroll direction, speed, and position to create dynamic, performant UI effects. The article explains the syntax, current browser support, and practical use‑cases. It also points readers to the original post and the CSS‑Tricks newsletter for deeper dives.
Why it matters
scroll-state() provides a native, CSS‑only way to react to scrolling, reducing reliance on JavaScript, improving performance, and simplifying maintenance of interactive layouts. Knowing it helps developers build smoother, more accessible experiences as browsers add support.
Key takeaways
- scroll-state() is a media query that reacts to scroll direction, speed, and position
- Syntax mirrors other media features, e.g., @media (scroll-state: smooth) { … }
- Current support is limited to Chromium‑based browsers; fallback strategies are needed
- Common use‑cases include sticky headers, reveal‑on‑scroll animations, and lazy‑loading effects
- Using scroll-state() can lower JavaScript payload and improve perceived performance