@supports
noun
say it: “AT suh-PORTS” /æt səˈpɔːrts/
A CSS feature query: the rules inside it apply only in browsers that understand the feature you name, while older browsers skip the block and keep the simpler styles.
What does @supports do?
@supports is a feature query: the rules inside it apply only in browsers that understand the feature you name. Older browsers skip the whole block and keep the simpler styles written before it.
.gallery { display: flex; flex-wrap: wrap; } /* works everywhere */
@supports (display: grid) {
.gallery { display: grid; grid-template-columns: repeat(3, 1fr); }
}
In a sentence
- “An @supports block lets me try a new CSS feature without breaking the page for anyone.”
- “I put the grid layout inside @supports (display: grid), so older browsers keep the plain flex gallery.”
Level: Journeyman · More CSS terms at this level
Updated