Listen "Custom Media Feature Flags"
Episode Synopsis
A fun use case for @custom-media queries is to toggle styles based on a feature flag.
Imagine an edge worker that toggles true or false in a CSS file, and the rest of your styles can tap in and adapt.
A/B testing
Unique user features
Reveal Debug elements
v2 layouts
you name it.
Syntax
#
Define an enabled feature like:
@custom-media --feature-flag true;
Or a disabled feature like:
@custom-media --debug-flag false;
Use them like:
@media (--feature-flag) {
body {
…
}
}
.component {
@media (--debug-flag) {
…
}
}
Use nesting, query from JavaScript, or both.
More custom media
#
The spec, a CSS Tricks article, post by Stefan Judis, a polyfill, a premade set in Open Props (anticipating the feature), and there's been good browser implementation activity recently in Firefox (marked FIXED!) and Chrome, not webkit as much.
I'm excited, it's a great feature.
More episodes of the podcast Adam Argyle
Games Of December 2025
27/12/2025
Ios Vs Android In 2025
27/12/2025
WWW Ep224 Spooky Scary CSS
25/12/2025
WWW Ep223 With David K Piano
19/12/2025
Bring The Color
16/12/2025
5 WebGL Tools of 2025
09/12/2025
CSS Text Grow
05/12/2025
On The Ux Show
02/12/2025
ZARZA We are Zarza, the prestigious firm behind major projects in information technology.