CSS Tools
Advertisement
Google AdSense Placement Area
Responsive Ad Unit
Back to All Tools/Modern CSS/Container Query Inspector
CSS Layout

CSS Container Query Inspector

.card-wrapper {
  container-type: inline-size;
  container-name: card-wrapper;
}

@container card-wrapper (min-width: 400px) {
  .card {
    flex-direction: row;
  }
}
Drag Container Width (450px)Breakpoint: 400px

Modular Card Component

Layout adapts based on parent wrapper width, not screen size!

Advertisement
Google AdSense Placement Area
Responsive Ad Unit

Micro-Architecture via Size Containment

Decoupling component layout logic from global viewport dimensions.

The fundamental limitation of traditional CSS @media queries is their macroscopic scope. Media queries only evaluate the dimensions of the entire browser window. Consequently, if a developer builds a reusable "Card" component, its breakpoint logic is inextricably coupled to the global page layout rather than the actual space available to the card itself.

The CSS @container specification represents a paradigm shift toward modular, context-aware components. By declaring container-type: inline-size on a parent wrapper, the browser engine constructs an isolated containment context within the rendering tree.

This isolation is vital. Without layout containment, evaluating a container's size could trigger cyclic dependencies (infinite render loops) where children recalculate dimensions based on parents, causing the parent to resize, subsequently triggering another child recalculation. By restricting the query strictly to the inline axis (width), the engine guarantees a unidirectional layout flow. The resulting component becomes entirely autonomous—capable of rendering horizontally in a wide grid track, and collapsing vertically when dropped into a narrow sidebar constraint, completely blind to the global viewport state.

Browser Matrix: Size Containment Spec

Native engine support for @container queries

Rendering EngineSupportThreshold
Blink (Chrome/Edge)Fullv105+
WebKit (Safari)Fullv16+
Gecko (Firefox)Fullv110+

Containment Tree FAQ

Advertisement
Google AdSense Placement Area
Responsive Ad Unit