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.
@supports
Baseline Widely available
Supported in Chrome: yes.
Supported in Edge: yes.
Supported in Firefox: yes.
Supported in Safari: yes.
This feature is well established and works across many devices and browser versions. It’s been available across browsers since September 2015
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
- Start with solid fallback styles that work everywhere
- Use
@supports
to enhance the experience with modern features - Test features individually when possible
- Consider using multiple
@supports
rules for different feature combinations - Keep fallback code maintainable - don’t create overly complex style overrides