coderef

Container queries (size)Baseline · Widely available

Container size queries with the @container (…) at-rule apply styles to an element based on a dimension of its container, such as width or height.

Supported in all major browsers for at least 30 months — safe to use without fallbacks. Baseline since Feb 14, 2023. Widely available since Aug 14, 2025.

Browser support

DesktopChrome
1–104Not supported
105+Supportedsince Sep 2, 2022
Current: 155
Edge
12–104Not supported
105+Supportedsince Sep 1, 2022
Current: 154
Firefox
1–109Not supported
110+Supportedsince Feb 14, 2023
Current: 157
Safari
1–15.6Not supported
16+Supportedsince Sep 12, 2022
Current: 27
MobileChrome Android
18–104Not supported
105+Supportedsince Sep 2, 2022
Current: 155
Firefox Android
4–109Not supported
110+Supportedsince Feb 14, 2023
Current: 157
Safari iOS
1–15.6Not supported
16+Supportedsince Sep 12, 2022
Current: 27

How to use

This feature is Baseline widely available — use it freely, no fallback needed.

Example

CSS
.card-list {
  container-type: inline-size;
  container-name: cards;
}

/* Lay the card out horizontally once its container is wide enough */
@container cards (min-width: 400px) {
  .card {
    display: grid;
    grid-template-columns: 120px 1fr;
  }
}

Feature detection

CSS · check before using
@supports (container: initial) {
  /* styles that rely on container */
}

/* or in JavaScript */
if (CSS.supports("container", "initial")) {
  // use it
}

Sub-features

Support for each part of the feature (12). The overall table above shows when the whole feature works.

Sub-featureChromeEdgeFirefoxSafariChrome AndroidFirefox AndroidSafari iOS
CSSContainerRule1051051101610511016
CSSContainerRule.containerName1111111101711111017
CSSContainerRule.containerQuery1111111101711111017
@container1051051101610511016
container1051051101610511016
container-name1051051101610511016
container-name.none1051051101610511016
container-type1051051101610511016
container-type.inline-size1051051101610511016
container-type.normal1051051101610511016
container-type.size1051051101610511016
<length>.container_query_length_units1051051101610511016