v137 · css
Progressive Enhancement
if(supports(…)) within a CSS declaration lets you apply a new CSS feature when available and fall back gracefully when not — all inline, without a separate @supports rule wrapping an entire block. Each property gets its own fallback right where it's declared.
if() is not supported in this browser. The progressive enhancement patterns will not apply. Use Chrome 137+.
corner-shape: squircle fallback
border-radius: if(supports(corner-shape: squircle): 30%; else: 50%) — same rounded card, just a squircle when the browser supports it.
progressive
both browsers
block needed
text-box trim fallback
text-box: if(supports(text-box: trim-both): trim-both; else: normal) — tight leading when supported, standard line-height elsewhere.
Headline Text
Body text immediately after the heading with no extra leading space above or below.
Tight Spacing
Chrome 137+ trims the invisible space above the cap-height and below the baseline — one inline if() does it.
container query layout fallback
display: if(supports(container-type: inline-size): grid; else: block) — icon+text two-column layout when container queries are available.
before vs after
| pattern | without if(supports()) | with if(supports()) |
|---|---|---|
| corner-shape | @supports { .card { corner-shape:… } } | border-radius: if(supports(…): 30%; else: 50%) |
| text-box | @supports rule wrapping h1, p declarations | text-box: if(supports(…): trim-both; else: normal) |
| container-type layout | @supports (container-type:…) { display: grid } | display: if(supports(…): grid; else: block) |
| cascade location | fallback and enhancement are in separate blocks | fallback and enhancement are in the same declaration |
| specificity | @supports adds no specificity but changes cascade | if() resolves at computed-value time, no specificity effect |
/* Old pattern: @supports blocks all properties together */
.card {
border-radius: 50%;
}
@supports (corner-shape: squircle) {
.card {
border-radius: 30%;
corner-shape: squircle;
}
}
/* New pattern: each property carries its own fallback */
.card {
border-radius: if(supports(corner-shape: squircle): 30%; else: 50%);
corner-shape: if(supports(corner-shape: squircle): squircle);
/* fallback: property simply unset or uses initial value */
}
see also
- CSS if() basics
- if() resolver — visualise supports() evaluation
- Dark Mode Tokens — if(media()) for color schemes
- ChromeStatus entry