coderef

Inline-size containmentBaseline · Widely available

The contain: inline-size CSS declaration prevents the element's inline dimension from being set by the element's contents. This permits the browser to avoid slower layout calculations.

Supported in all major browsers for at least 30 months — safe to use without fallbacks. Baseline since Sep 12, 2022. Widely available since Mar 12, 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–100Not supported
101+Supportedsince May 31, 2022
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–100Not supported
101+Supportedsince May 31, 2022
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

Full syntax and examples are on MDN — see the links below.

Feature detection

CSS · check before using
@supports (contain: inline-size) {
  /* styles that rely on contain: inline-size */
}

/* or in JavaScript */
if (CSS.supports("contain", "inline-size")) {
  // use it
}