freecoding.school100% FREE · NO SIGNUP
Neon DistrictISSUE #41 of 50

@supports · feature queries

PrismaVSJank the Janitor
Prisma says@supports tests whether the browser understands a feature before using it (feature queries).

@supports (display: grid) { … } applies rules only if the browser supports that declaration. It's progressive enhancement in CSS: ship a baseline everyone gets, then layer modern features for capable browsers. Test the negative with @supports not (...).

Power-ups you unlock

Jank the Janitor attacks — common mistakes

Boss battleProvide a flex fallback, then enhance to grid inside @supports (display:grid).

Example code

<!doctype html><html><head><meta charset="utf-8">
<style>.g{display:flex;gap:8px}@supports(display:grid){.g{display:grid;grid-template-columns:1fr 1fr}}.g div{background:#b388ff;color:#06040d;padding:14px}</style></head><body style="background:#06040d;padding:20px"><div class="g"><div>a</div><div>b</div></div></body></html>
▶ Open the interactive comic issue
‹ Print Styles · @Media Print@Import · Loading Stylesheets ›