Feature Queries

๐ŸŽจ CSS3+ ๐ŸŸข Chapter 45 of 49 ๐Ÿ“‚ Phase 16: Modern CSS ๐Ÿ“… 2026 Edition
๐Ÿ“Œ Covered in this chapter: @supports ยท Progressive Enhancement ยท Fallbacks ยท Feature Detection ยท Grid Fallback ยท Container Query Fallback ยท Modern Color Fallback ยท Graceful Degradation ยท Testing
Welcome to Chapter 45: Feature Queries โ€” part of the CSS Complete Roadmap. This lesson covers all subtopics with clear explanations, code examples, and best practices used in professional web development.
๐Ÿ“š What You Will Learn
  • @supports rule for feature detection in CSS
  • Progressive enhancement strategy โ€” base first, enhance later
  • Fallback patterns for Grid, Container Queries, modern colors
  • Graceful degradation for older browsers
  • Production testing across browser versions
๐Ÿ’ก Why This Matters

Not all users have the latest browser. @supports lets you write cutting-edge CSS while providing solid fallbacks โ€” no JavaScript feature detection needed. This is the CSS-native way to do progressive enhancement.

1@supports Syntax & Basic Usage
.card {
  display: block;
}

@supports (display: grid) {
  .card {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
  }
}

@supports (aspect-ratio: 1) {
  .thumbnail { aspect-ratio: 16/9; }
}

@supports not (container-type: inline-size) {
  .sidebar { width: 240px; }
}
Property / SelectorExplanation
@supports (prop: value)Browser supports property โ€” apply nested rules
@supports not (...)Browser does NOT support โ€” apply fallback
@supports (A) and (B)Both must be supported
@supports (A) or (B)Either one supported
2Progressive Enhancement Patterns
CSS โ€” Grid with Flexbox Fallbackโ–ถ Try in Editor
.layout {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.layout > * {
  flex: 1 1 280px;
}

@supports (display: grid) {
  .layout {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
  }

  .layout > * { flex: unset; }
}
CSS โ€” Modern Color Fallbackโ–ถ Try in Editor
.hero {
  background: #2563eb; /* fallback */
  background: oklch(54% 0.22 264); /* modern browsers */
}

@supports (color: color-mix(in srgb, red, blue)) {
  .hero-overlay {
    background: color-mix(in srgb, #2563eb 80%, transparent);
  }
}
3Production Testing & Graceful Degradation
  • caniuse.com โ€” check feature support before using
  • BrowserStack / LambdaTest โ€” test on real older browsers
  • Strategy: Base styles work everywhere โ†’ @supports adds enhancements
  • Never: @supports only block without fallback outside
  • CSS.supports() in JS: CSS.supports('display', 'grid') for dynamic loading
โ“ Mini Quiz

Q1 @supports media queries la work avuthundaa?

Similar concept โ€” media queries check viewport/device, @supports checks CSS feature support in browser.

Q2 Progressive enhancement vs graceful degradation?

Progressive enhancement: base experience first, add features. Graceful degradation: full experience first, fallback for old browsers. PE is preferred modern approach.

โœ… Quick Recap
  • @supports detects CSS feature support at runtime
  • Always provide fallback styles OUTSIDE @supports block
  • Use for Grid, container queries, oklch colors, nesting
  • Test on caniuse.com and real devices before production
  • Progressive enhancement = accessible to all, enhanced for modern browsers
OC
Written by Our Compiler Technical Editorial Team
Reviewed for accuracy ยท CSS Complete Roadmap ยท Last updated August 2026