v133 · css
CSS Scroll State Container Queries
Use container queries to style descendants of containers based on their scroll state.
concepts
-
Scroll-state Container Queries
@container scroll-state(stuck/scrolled/snapped: …) for styling based on scroll position relative to a container.
-
Sticky shrink header
The explainer's marquee use case: a sticky header that compacts and reveals its Subscribe button on stick — pure CSS, no
IntersectionObserveron a sentinel. -
Snapped gallery
The
snappedstate styles the card currently locked to a scroll-snap point — sharpen, scale up, and badge “in view” without anIntersectionObserver. -
Scrolled progress
The
scrolledstate appears once reading has begun — pop in a back-to-top button and intensify the sticky-header shadow once the user has actually scrolled. -
Sticky Column
A horizontally-scrollable data table with a
position: sticky; left: 0first column.@container scroll-state(stuck: left)fires the moment the column hits the left viewport edge, adding a drop-shadow and accent border — noIntersectionObserver, no JS scroll listeners. Shows thestuck: left/right/top/bottomvalue family alongside the classicstuck: topheader pattern.
why it shipped
See explainer