@container
Widely availableSince 202396% of users
Lets you style elements based on their container, the nearest ancestor set up as one, by its size or its custom property values rather than the whole viewport.
What's modern
From web-features, MDN's browser data and our snippets, checked dailyModernIn every major browser since February 2023. Widely available since August 2025.
Newer parts of @container
Style queries for custom propertiesBaseline May 2026<container-query> is optional (allows name-only queries)Baseline May 2026
See how modern your own CSS is.Check your CSS →
Quick example
/* 1. Define the container */
.card-layout {
container-type: inline-size;
}
/* 2. Use the container query */
@container (min-width: 700px) {
.card {
display: grid;
grid-template-columns: 2fr 1fr;
}
}@container browser support
BaselineWidely availableThis feature is well established and works across many devices and browser versions. It has been available across browsers since 2023.Safe to use without fallbacks.
Usage96%of people can use this4% use a browser without it.
Browsers
105+
110+
16+
105+Mobile
105+Android
110+Android
16+iOS