CSS container queries work in Chrome 105+, Edge 105+, Firefox 110+, Safari 16+, Opera 91+, and Samsung Internet 20+. Learn CSS container queries support.

Prince Dewani
May 5, 2026
CSS container queries are a W3C CSS Containment feature that styles a child element based on the size or style of its parent container, not the viewport. They work in Chrome 105+, Edge 105+, Firefox 110+, Safari 16+ on macOS and iOS, Opera 91+, and Samsung Internet 20+, while Internet Explorer has no support.
This guide covers what CSS container queries are, the browsers that support them, their features, how they differ from media queries, the syntax, and known issues.
CSS container queries are a CSS Containment Module Level 3 feature from the W3C CSS Working Group. They use the @container at-rule and the container-type and container-name properties to style child elements based on the size or computed style of a parent container, so one component can adapt to many layout slots without checking the viewport.
CSS container queries work in every modern desktop and mobile browser, with Chrome and Edge first in version 105, Safari in version 16, and Firefox in version 110.
Chrome supports CSS container queries from Chrome 105 on Windows, macOS, Linux, ChromeOS, and Android. Chrome 92 to 104 had the feature behind the chrome://flags/#enable-container-queries flag, and Chrome versions before 92 did not support @container at all. Chrome 111 added style queries on CSS custom properties, and Chrome 133 added scroll-state container queries.
Microsoft Edge supports CSS container queries from Edge 105 on Windows, macOS, Linux, and Android. The feature is on by default, with no flag required. Edge 12 to 104 did not support @container or container query units. Edge 111 added style queries on CSS custom properties to match the Chromium upstream.
Firefox supports CSS container queries from Firefox 110 on Windows, macOS, Linux, and Android. No flag is needed. Firefox 2 to 109 did not support @container or any container query units. Firefox does not yet support style queries or scroll-state queries; teams targeting Firefox can rely on size queries only.
Safari supports CSS container queries from Safari 16 on macOS Ventura and from Safari 16 on iOS and iPadOS. Both platforms ship size queries and the cqw, cqh, cqi, cqb, cqmin, and cqmax units. Safari 18 added style queries on CSS custom properties on macOS Sequoia and iOS 18. Safari 3.1 to 15.6 on macOS and Safari on iOS before version 16 did not support @container.
Opera supports CSS container queries from Opera 91 on Windows, macOS, Linux, and Android, tracking the Chromium 105 base. Opera 79 to 90 had the feature behind the same enable-container-queries flag as Chrome, and earlier Opera versions did not support it. Opera Mobile 80 and later support container queries on Android.
Samsung Internet supports CSS container queries from Samsung Internet 20 on Galaxy phones and tablets. Samsung Internet 4 to 19 did not support @container. Samsung Internet 22 added style queries on CSS custom properties for parity with the Chromium 111 base.
The Chromium-based Android Browser supports CSS container queries from version 105, matching desktop Chrome. The legacy stock Android Browser, frozen at Android 4.4, does not support @container or container query units. Use Chrome for Android, Firefox for Android, or Samsung Internet on modern Android phones for full container query support.
Internet Explorer never added support for CSS container queries. IE 5.5 through IE 11 do not recognize the @container at-rule, container-type, container-name, or any cq length unit. Microsoft has retired Internet Explorer 11 and recommends Edge for any site that needs container queries.
Note: CSS container queries behave differently in Safari, Firefox, and Chrome around style queries and unsized containers. Test them on real browsers and OS with TestMu AI. Try TestMu AI free!
CSS container queries cover three query types and six length units, all driven by the @container at-rule and the container-type property.
CSS container queries and media queries both gate styles behind a condition, but they query different scopes, target different elements, and reach different browsers. The table below maps the trade-offs that drive the choice between @container and @media for a layout.
| Dimension | CSS Container Queries | CSS Media Queries |
|---|---|---|
| Query scope | Parent element with container-type set on it | Whole viewport, browser window, or device |
| At-rule | @container | @media |
| Opt-in step | Set container-type on the parent before any query fires | None, every viewport always matches |
| Reusable components | Same component restyles in any container width | Component restyles only when the viewport changes |
| Length units | cqw, cqh, cqi, cqb, cqmin, cqmax | vw, vh, vmin, vmax, dvw, dvh |
| Browser reach | Chrome 105+, Edge 105+, Firefox 110+, Safari 16+, Opera 91+, Samsung Internet 20+ | Every modern browser plus Internet Explorer 9 and later |
| Performance cost | Layout containment runs on every container element | None beyond the query check itself |
Container queries take three steps: declare a container on the parent, name it if a child needs a specific target, and write @container rules that change child styles when the container matches a condition.
/* Step 1: Declare a containment context on the parent */
.card-grid {
container-type: inline-size;
container-name: card;
}
/* Step 2: Query the named container by width */
@container card (width > 480px) {
.card {
display: grid;
grid-template-columns: 200px 1fr;
gap: 1rem;
}
}
/* Step 3: Use container query units for fluid sizing */
@container card (width > 320px) {
.card h2 {
font-size: clamp(1.25rem, 4cqi, 2rem);
}
}If the rule never fires, container-type is most likely missing on the parent or set on the wrong ancestor; the closest ancestor with container-type wins, so check the cascade in DevTools.
CSS container queries work cleanly across modern browsers, but the spec design has a few sharp edges that catch teams the first time they ship them.
In my experience, the container-type sizing trap catches teams the most. A card that was happy in a flex layout collapses to zero width the moment you add container-type: inline-size to a flex item, because the parent stops sizing it from content. The fix is usually flex-basis: auto plus min-width: 0 on the container, or moving container-type onto a wrapper that already has explicit width.
All CSS container queries version numbers and platform notes in this guide come from these primary sources:
Did you find this page helpful?
More Related Hubs
TestMu AI forEnterprise
Get access to solutions built on Enterprise
grade security, privacy, & compliance