Working Draft · mediaqueries

Media Queries

1 at-rule defined by this specification, all known to at least one browser .

The feature in detail

@custom-media

At-rule Limited availability Experimental

MDN The @custom-media CSS at-rule defines aliases for long or complex media queries. Instead of repeating the same hardcoded <media-query-list> in multiple @media at-rules, it can be defined once in a @custom-media at-rule and referenced throughout the stylesheet whenever needed.

Syntax

@custom-media <extension-name> [ <media-query-list> | true | false ] ;

Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.

Browser support

First browser version supporting @custom-media
Chrome No
Edge No
Firefox 148 (flag)
Safari No
Chrome Android No
Safari iOS No

First version with support, from MDN browser-compat-data.