CSS @supports: Write Future-Proof CSS

Use CSS @supports to check whether a browser supports a feature such as grid, and give other browsers a fallback. How it works, with multiple conditions.

I use @supports constantly to check if browsers can handle modern CSS features. Think of it as a safety net for your styles - if a browser doesn’t support a feature, you can provide a solid fallback.

Here’s what it looks like in practice:


How @supports Works

The @supports rule checks if a browser understands a CSS property-value pair. You can test for single or multiple features:

Here’s how I use @supports to progressively improve a layout:


Testing Multiple Properties

Sometimes you need to test for multiple CSS properties. Here’s how to handle complex feature detection:


Best Practices

  1. Start with solid fallback styles that work everywhere
  2. Use @supports to enhance the experience with modern features
  3. Test features individually when possible
  4. Consider using multiple @supports rules for different feature combinations
  5. Keep fallback code maintainable - don’t create overly complex style overrides

Trevor I. Lasn

Trevor I. Lasn

Building whiteheap.com and 0xinsider.com.



Related Articles

Check out these related articles that might be useful for you. They cover similar topics and provide additional insights.

CSS
3 min read

A look at how browsers can highlight text fragments using CSS ::target-text, making text sharing and navigation more user-friendly

Dec 17, 2024
Read article
CSS
3 min read

The ::details-content pseudo-element lets you style the expandable content of details elements separately from the summary, no divs needed.

Nov 11, 2025
Read article
CSS
3 min read

The new pseudo-classes :user-valid and :user-invalid give us a smarter way to style form validation states based on user interaction

Dec 12, 2024
Read article
CSS
4 min read

How to implement the Open-Dyslexic font to enhance readability for users with dyslexia

Oct 12, 2024
Read article
CSS
4 min read

CSS nesting is finally supported in all major browsers. Write cleaner, organized stylesheets without Sass or Less

Dec 6, 2024
Read article
CSS
3 min read

Use scrollbar-width to thin or hide scrollbars and scrollbar-gutter to prevent layout shift. Browser support, examples, and gotchas.

Dec 19, 2024
Read article
CSS
4 min read

Exploring new CSS line-height units that eliminate guesswork from vertical rhythm

Dec 3, 2024
Read article
CSS
8 min read

Create animated transitions between different states of your app without complex animation libraries.

Nov 11, 2025
Read article
CSS
3 min read

content-visibility: auto lets the browser skip layout and paint for offscreen elements until they are needed. How to use it with contain-intrinsic-size.

Dec 5, 2024
Read article

This article was originally published on https://www.trevorlasn.com/blog/detect-css-features-with-supports-property. It was written by a human and polished using grammar tools for clarity.