container query

A CSS rule, written with @container, that styles a component based on the size of its container instead of the whole viewport.

In more detail

An ancestor becomes a query container with container-type: inline-size. Rules inside @container (min-width: 400px) then react to that container's width, so the same card lays out differently in a narrow sidebar and a wide main column.

Related terms

Taught in

References