New CSS features arrive faster than everyone updates their browser. With @supports you write the new version for browsers that understand it, and keep a fallback for the rest.
.layout { display: block; }
@supports (display: grid) {
.layout { display: grid; grid-template-columns: 1fr 3fr; }
}
The rule inside only applies when the browser supports that property and value. You can combine conditions with and, or and not:
@supports (display: table-cell) and (display: list-item) { }
@supports not (transform-origin: 10em 10em 10em) { }
It also checks selectors with selector(). MDN’s example uses it for a fallback when :has() is missing:
@supports not selector(:has(a, b)) {
/* styles for browsers without :has() */
}
That is where I find it most useful today: features like :has() that change how you write a layout, where a missing feature would leave the page broken instead of plain.
Caveats. When you mix and and or, you need parentheses around the parts; MDN warns that without them the whole rule is ignored. It also only asks whether the browser parses the declaration, not whether it renders it without bugs. And it adds work: every @supports block is a second path to test, so I use it for features that matter for the layout, not for small extras.
Further reading: MDN: @supports, On this site: CSS object-fit: cover fills a box without stretching