← Back to CSS
59

CSS compatibility: support, prefixes and strategy

Learn how to write resilient CSS with real fallbacks, `@supports`, vendor-prefix tooling and a progressive-enhancement mindset, so modern features improve the experience without breaking older environments.

📘 Theory

The four ideas that matter most

Keep this mental model in mind whenever you adopt a new CSS feature.

1

`@supports` feature queries

They let you apply an enhancement only when the browser understands the property-value pair you depend on.

2

Vendor prefixes

Use tooling such as Autoprefixer instead of hand-writing prefixes unless you are solving a very specific edge case.

3

Progressive enhancement

Start with a working default, then upgrade the experience without putting the baseline at risk.

4

Real compatibility decisions

Use Can I Use, Browserslist and your actual audience data to decide what support target makes sense.

Using `@supports` as a decision layer

`@supports` checks whether the browser understands a concrete declaration before applying the enclosed rules. That makes it the native conditional system of CSS.

You can combine checks with `and`, `or` and `not` to model realistic support paths instead of creating messy overrides.

This is especially useful for upgrades such as `subgrid`, `backdrop-filter` or container queries, where the baseline layout must still work if the enhancement is unavailable.

  • Basic pattern: `@supports (display: grid) { ... }`
  • Negation: `@supports not (display: grid) { ... }`
  • Combined condition: `@supports (display: grid) and (gap: 1rem) { ... }`

Prefixes without turning your CSS into noise

Prefixes such as `-webkit-`, `-moz-` and `-ms-` still appear in some browser support stories, especially around older implementations or properties with an uneven rollout.

In production projects, the cleanest solution is usually Autoprefixer plus Browserslist. You write modern CSS, define your browser target, and let the tool generate only what is still necessary.

Remember that unsupported declarations are simply ignored. That is why fallbacks and declaration order still matter even when a build tool is helping you.

  • Autoprefixer adds the required prefixes automatically.
  • Browserslist defines the browsers you care about.
  • Hand-written prefixes should be the exception, not the default.

Progressive enhancement in real layouts

1

Begin with a version that is completely usable. For a card list, that might mean Flexbox with wrapping and comfortable spacing.

2

Then add the improved version with `@supports`: Grid, `subgrid`, visual blur or any more advanced enhancement that genuinely improves the interface.

3

If the browser cannot use the upgrade, it simply keeps the solid base. That is the real value of progressive enhancement: stability first, refinement second.

🧪 Learn by doing

Example `@supports` with `subgrid` Apply `subgrid` only when the browser actually supports it.
Example Fallback for `backdrop-filter` The blur is optional; the solid background preserves readability when the effect is missing.

🏁 Challenges

Challenge Challenge: fallback plus `@supports` Build the baseline with Flexbox and switch to Grid only when it is supported.

🧰 Resources

Test

Check your knowledge with a test about CSS.

Test for CSS

What is this?

I'm Cristian Eslava and I sometimes build websites so both you and I can learn and experiment. culTest

I made this in February 2026 to make learning easier for my students. The idea is to learn web development by practicing and to keep expanding the project with new topics, tests and challenges.

It draws inspiration from MDN, W3Schools, CodePen, Manz and many other web development references. I wanted to combine useful theory, runnable examples, challenges and the testing system I had already built for culTest. culTest

If you liked it, if you didn't, or if you want to get in touch, write to me at cristianeslava@gmail.com