[KongchangAI]
ConceptContainer Queries

Container Queries

A CSS feature that allows components to adjust their styles based on the dimensions of their containing element rather than the viewport width. This enables components to adapt automatically across different layout contexts, reinforcing the principle of content–style separation.

Timeline (last 90 days)

Oct 30

Native CSS alternatives include features already supported by modern CSS such as nesting, container queries, and :has(), so many scenarios that previously required framework assistance can now be implemented in pure CSS.

Unverified50%
Oct 22

When no container is defined, the cqi unit falls back to the viewport size, so the same piece of code using cqi works in both the viewport and container scenarios.

Unverified50%
Oct 22

container-type: inline-size makes an element a queryable container in the inline direction, allowing child elements to use units such as cqw and cqi; container-type: size establishes both inline and block-size containment, supporting block-level units such as cqh and cqb.

Unverified50%
Oct 21

Container Queries became fully available in major browsers in 2023, centered on the @container rule together with the container-type property.

Unverified50%
Oct 21

Container queries allow components to adjust internal styles based on the size of the parent container rather than the viewport size, improving the context-independent reusability of components.

Unverified50%
Sep 19

Enabling container queries requires declaring container-type: inline-size (or simultaneously specifying container-name) on the parent element.

Unverified50%
Sep 19

The container query inline unit cqi equals 1% of the container's inline dimension, referencing the nearest declared container when one is found, and falling back to the viewport otherwise.

Unverified50%
Sep 19

When multiple elements are each declared as containers, the same font-size declaration will render different font sizes because each references its own container's dimensions.

Unverified50%
Sep 19

If no container is explicitly declared, container query units fall back to referencing the viewport, producing exactly the same stretching-zone problem as using viewport units.

Unverified50%
Sep 19

Re-declaring the registered length-type property --step-2 on direct children of the wrapper fixes the font-size calculation baseline to the wrapper's container dimensions, thereby ensuring consistent font sizes across containers.

Unverified50%

All Facts (10)

Unverified

Native CSS alternatives include features already supported by modern CSS such as nesting, container queries, and :has(), so many scenarios that previously required framework assistance can now be implemented in pure CSS.

50%
Unverified

When no container is defined, the cqi unit falls back to the viewport size, so the same piece of code using cqi works in both the viewport and container scenarios.

50%
Unverified

container-type: inline-size makes an element a queryable container in the inline direction, allowing child elements to use units such as cqw and cqi; container-type: size establishes both inline and block-size containment, supporting block-level units such as cqh and cqb.

50%
Unverified

Container Queries became fully available in major browsers in 2023, centered on the @container rule together with the container-type property.

50%
Unverified

Container queries allow components to adjust internal styles based on the size of the parent container rather than the viewport size, improving the context-independent reusability of components.

50%
Unverified

Enabling container queries requires declaring container-type: inline-size (or simultaneously specifying container-name) on the parent element.

50%
Unverified

The container query inline unit cqi equals 1% of the container's inline dimension, referencing the nearest declared container when one is found, and falling back to the viewport otherwise.

50%
Unverified

When multiple elements are each declared as containers, the same font-size declaration will render different font sizes because each references its own container's dimensions.

50%
Unverified

If no container is explicitly declared, container query units fall back to referencing the viewport, producing exactly the same stretching-zone problem as using viewport units.

50%
Unverified

Re-declaring the registered length-type property --step-2 on direct children of the wrapper fixes the font-size calculation baseline to the wrapper's container dimensions, thereby ensuring consistent font sizes across containers.

50%

Source Articles