Tutorial 36 of 44 in series
CSS Feature Queries
Detect browser support with @supports
Abhishek Sharma 2026-05-30 Web Development / Frontend / CSS
Feature Queries
The @supports rule checks if the browser supports a specific CSS feature before applying styles.
Demo: @supports Example
HTML
<div class="supports-demo">
This uses grid if supported, otherwise falls back
</div> CSS
.supports-demo {
background: #f1f5f9;
padding: 20px;
border-radius: 8px;
font-weight: bold;
text-align: center;
}
@supports (display: grid) {
.supports-demo {
display: grid;
place-items: center;
background: #eef2ff;
border: 2px solid #6366f1;
color: #6366f1;
}
}
@supports not (display: grid) {
.supports-demo {
border: 2px solid #dc2626;
color: #dc2626;
}
}
Live Output Window
Syntax
/* Check support for a property:value pair */
@supports (display: grid) { }
/* Check NOT supported */
@supports not (display: grid) { }
/* Multiple conditions (AND) */
@supports (display: flex) and (gap: 8px) { }
/* Multiple conditions (OR) */
@supports (display: grid) or (display: flex) { }
Why Use Feature Queries?
- Progressive enhancement - use modern features with graceful fallbacks
- No browser detection needed - test features directly
- Future-proof - styles automatically activate when browsers add support
Unlike media queries that check the viewport, feature queries check the browser capabilities.
Keep learning
Related tutorials from across the library.
Tutorial
Introduction to CSS
Learn what CSS is and why it matters
Web Development / Frontend / CSS
CSSWeb Development
Tutorial
History of CSS
Understand how CSS evolved
Web Development / Frontend / CSS
CSSWeb Development
Tutorial
Adding CSS
Three ways to add CSS to a page
Web Development / Frontend / CSS
CSSWeb Development