Check
Ask if a declaration is supported.
@supports lets CSS ask the browser whether a feature is available before applying advanced rules.
@supports (container-type: inline-size) {
.panel { container-type: inline-size; }
}
Production mental model
The @supports rule is a feature query. It checks whether the browser understands a CSS declaration.
Use it to protect enhancements that depend on newer CSS. The fallback stays outside the block; the advanced version lives inside.
This keeps modern CSS usable without forcing every browser to understand every feature.
Ask if a declaration is supported.
Write normal CSS outside the block first.
Put advanced CSS inside @supports.
Use not, and and or when needed.
Visual model
Base CSS applies to everyone.
Browser evaluates the feature.
Modern CSS improves the component.
The fallback remains usable.
Good CSS versus fragile CSS
.panel { width: min(100%, 42rem); }
@supports (container-type: inline-size) {
.panel-list { container-type: inline-size; }
}
@supports (container-type: inline-size) {
.panel { container-type: inline-size; }
.panel-card { grid-template-columns: subgrid; }
}
Rules of thumb
The page should work before the feature query runs.
@supports tests whether a property-value pair is understood.
Do not wrap every normal declaration in @supports.
Only the parts that need the feature belong inside the block.
@supports not can create fallbacks, but base-first CSS is often clearer.
Temporarily change the condition to verify fallback and enhancement behavior.
Production thinking
@supports lets you use modern CSS with confidence instead of waiting years for every browser edge case.
The fallback path must be accessible too. Do not put essential visibility, order or focus behavior only inside enhancement code.
Feature queries are best when they protect specific features that have real support risk.
Fallback-first CSS keeps content visible and usable even without advanced feature support.
Live code lab
The preview runs in an isolated iframe. Links and forms stay inside the practice area, so you can experiment without leaving the lesson.
Mini assignment
Practice assignment
Try it yourself
Self-check
Answer these questions before moving on. Production CSS is not about writing more rules; it is about proving the rules survive real use.
Senior audit upgrade
Feature queries are useful when a modern feature improves the design but the baseline must still work.
Use @supports (display: grid) for enhanced layouts.
@supports not (...) can define fallback-specific fixes.
If the baseline already works well, a feature query may add unnecessary complexity.