01 / 06
Container Queries Land in CSS
The original @container queries respond to an element's own size, enabling truly component-driven responsive design for the first time.
CSSv149 · CSS
Scroll the carousel below. The snapped card expands its text, scales up, and flips to inverted colours — using only @container scroll-state(snapped: x). No JavaScript tracks the active index.
← drag or scroll to snap between slides →
/* Each slide is its own scroll-state container */
.slide {
container-type: scroll-state;
container-name: slide;
scroll-snap-align: center;
}
/* Base (not snapped) — scaled down, no excerpt */
.slide-inner {
transform: scale(0.93);
transition: transform 0.3s, background 0.3s;
}
.slide-excerpt {
max-height: 0;
opacity: 0;
transition: max-height 0.4s, opacity 0.3s;
}
/* Snapped — expands, inverts, scales up */
@container slide scroll-state(snapped: x) {
.slide-inner {
transform: scale(1);
background: var(--text-black);
}
.slide-excerpt {
max-height: 6rem;
opacity: 1;
color: var(--bg-stone);
}
}
scroll-state(stuck: top)scroll-state(scrollable: …)Need the exact API surface, compatibility boundaries, errors, lifecycle, and source links? Read the matching gendn reference ↗