Container Query
Styling based on the size of an element's container rather than the viewport.
A container query applies styles based on the dimensions of a designated ancestor rather than the viewport. It is the answer to a problem that viewport-based Responsive Breakpoints cannot solve: a component's correct layout depends on the space it has been given, not on the size of the window.
The distinction becomes urgent as soon as anything else on the page can take space away. A navigation bar sized by viewport breakpoints will crowd and overflow the moment a panel opens beside it, because the viewport did not change but the available width did. Every editing interface that pushes content aside hits this, and it is a container problem across all of that interface's content, not a bug in the one component where it was noticed.
Container queries require declaring a containment context on the ancestor, which has layout implications of its own — a size container cannot be sized by its contents in the queried dimension. That constraint is what delayed the feature for years and is why retrofitting it into an existing layout is more than a find-and-replace.
Where they are not yet practical, the honest fallback is to make components tolerant of narrowness rather than to add more viewport breakpoints, which encode an assumption about available space that is simply wrong.
See also3
Hand-picked in the note itself — the neighbours worth reading next.
Responsive Breakpoint
A viewport width at which a layout changes, and the assumptions that come with it.
Design & Interface7 connections
Design System
A shared vocabulary of tokens, primitives, and rules that makes independent work converge.
Design & Interface9 connections
UI Primitive
The small set of typed components through which all interface markup is expressed.
Design & Interface10 connections
Related3
Nearby in the graph rather than deliberately chosen. Looser, sometimes surprising.
Linked from3
Notes elsewhere in the wiki that reach for this one.
- Design SystemDesign & Interface
A shared vocabulary of tokens, primitives, and rules that makes independent work converge.
- Responsive BreakpointDesign & Interface
A viewport width at which a layout changes, and the assumptions that come with it.
- UI PrimitiveDesign & Interface
The small set of typed components through which all interface markup is expressed.