coderef

Style containmentBaseline · Widely available

The contain: style CSS declaration permits the browser to avoid slower layout calculations by preventing modification to counter (counter-increment and counter-set) and quotation styles (content property quote values) beyond the element's descendants.

Supported in all major browsers for at least 30 months — safe to use without fallbacks. Baseline since Jul 26, 2022. Widely available since Jan 26, 2025.

Browser support

DesktopChrome
1–51Not supported
52+Supportedsince Jul 20, 2016
Current: 155
Edge
12–18Not supported
79+Supportedsince Jan 15, 2020
Current: 154
Firefox
1–102Not supported
103+Supportedsince Jul 26, 2022
Current: 157
Safari
1–15.3Not supported
15.4+Supportedsince Mar 14, 2022
Current: 27
MobileChrome Android
18–51Not supported
52+Supportedsince Jul 27, 2016
Current: 155
Firefox Android
4–102Not supported
103+Supportedsince Jul 26, 2022
Current: 157
Safari iOS
1–15.3Not supported
15.4+Supportedsince Mar 14, 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: style) {
  /* styles that rely on contain: style */
}

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