File tree 1 file changed +26
-0
lines changed
1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -2606,6 +2606,32 @@ Custom Media Queries</h2>
2606
2606
If <dfn value for="@custom-media">true</dfn> or <dfn value for="@custom-media">false</dfn> is given,
2607
2607
the <a>custom media query</a> evaluates to true or false, respectively.
2608
2608
2609
+ <div class=example>
2610
+ The [=custom media query=] is evaluated logically, not treated as a textual substitution.
2611
+ Take the following code snippet for instance:
2612
+ <pre><code class=lang-css>
2613
+ /* --modern targets modern devices that support color or hover */
2614
+ @custom-media --modern (color), (hover);
2615
+
2616
+ @media (--modern) and (width > 1024px) {
2617
+ .a { color: green; }
2618
+ }
2619
+ </code></pre>
2620
+ It is equivalent to:
2621
+ <pre><code class=lang-css>
2622
+ @media ((color) or (hover)) and (width > 1024px) {
2623
+ .a { color: green; }
2624
+ }
2625
+ </code></pre>
2626
+
2627
+ Processing it as if it meant the following would be incorrect:
2628
+ <pre><code class=lang-css>
2629
+ @media (color), (hover) and (width > 1024px) {
2630
+ .a { color: green; }
2631
+ }
2632
+ </code></pre>
2633
+ </div>
2634
+
2609
2635
A ''@custom-media'' rule can refer to other <a>custom media queries</a> .
2610
2636
However, loops are forbidden,
2611
2637
and a <a>custom media query</a> must not be defined in terms of itself or
You can’t perform that action at this time.
0 commit comments