Skip to content

Commit 1afd7e5

Browse files
committed
[mediaqueries] Explain what the media feature 'type' is.
1 parent 83f4253 commit 1afd7e5

2 files changed

Lines changed: 83 additions & 4 deletions

File tree

mediaqueries/Overview.html

Lines changed: 43 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
</p>
5555
<h1 class="p-name no-ref" id=title>Media Queries Level 4</h1>
5656
<h2 class="no-num no-toc no-ref heading settled heading" id=subtitle><span class=content>Editor’s Draft,
57-
<span class=dt-updated><span class=value-title title=20131110>10 November 2013</span></span></span></h2>
57+
<span class=dt-updated><span class=value-title title=20131112>12 November 2013</span></span></span></h2>
5858
<div data-fill-with=spec-metadata><dl><dt>This version:<dd><a class=u-url href=http://dev.w3.org/csswg/mediaqueries4/>http://dev.w3.org/csswg/mediaqueries4/</a><dt>Editor’s Draft:<dd><a href=http://dev.w3.org/csswg/mediaqueries4/>http://dev.w3.org/csswg/mediaqueries4/</a>
5959
<dt>Feedback:</dt>
6060
<dd><a href="mailto:www-style@w3.org?subject=%5Bmediaqueries%5D%20feedback">www-style@w3.org</a>
@@ -117,7 +117,8 @@ <h2 class="no-num no-toc no-ref heading settled heading" id=contents><span class
117117
Negating a Media Query: the <span class=css data-link-type=maybe title=not>not</span> keyword</a><li><a href=#mq-only><span class=secno>2.2.2</span>
118118
Hiding a Media Query From Legacy User Agents: the <span class=css data-link-type=maybe title=only>only</span> keyword</a></ul><li><a href=#media-types><span class=secno>2.3</span>
119119
Media Types</a><li><a href=#mq-features><span class=secno>2.4</span>
120-
Media Features</a><ul class=toc><li><a href=#mq-boolean-context><span class=secno>2.4.1</span>
120+
Media Features</a><ul class=toc><li><a href=#mq-ranges><span class=secno>2.4.1</span>
121+
Media Feature Types: “range” and “discrete”</a><li><a href=#mq-boolean-context><span class=secno>2.4.2</span>
121122
Evaluating A Media Feature in a Boolean Context</a></ul></ul><li><a href=#mq-syntax><span class=secno>3</span>
122123
Syntax</a><ul class=toc><li><a href=#error-handling><span class=secno>3.1</span>
123124
Error Handling</a></ul><li><a href=#media-features><span class=secno>4</span>
@@ -592,7 +593,45 @@ <h3 class="heading settled heading" data-level=2.4 id=mq-features><span class=se
592593
rel="stylesheet" href="example.css"&gt;
593594
</pre> </div>
594595

595-
<h4 class="heading settled heading" data-level=2.4.1 id=mq-boolean-context><span class=secno>2.4.1 </span><span class=content>
596+
<h4 class="heading settled heading" data-level=2.4.1 id=mq-ranges><span class=secno>2.4.1 </span><span class=content>
597+
Media Feature Types: “range” and “discrete”</span><a class=self-link href=#mq-ranges></a></h4>
598+
599+
<p> Every media feature defines its “type” as either “range” or “discrete” in its definition table.
600+
601+
<p> “Discrete” media features,
602+
like <a class=property data-link-type=propdesc href=#descdef-luminosity title=luminosity>luminosity</a> or <a class=property data-link-type=propdesc href=#descdef-script title=script>script</a>,
603+
take their values from a set.
604+
The values may be keywords
605+
or boolean numbers (0 and 1),
606+
but the common factor is that there’s no intrinsic “order” to them—<wbr></wbr>none of the values are “less than” or “greater than” each other.
607+
608+
<p> “Range” media features like <a class=property data-link-type=propdesc href=#descdef-width title=width>width</a>, on the other hand,
609+
take their values from a range.
610+
Any two values can be compared to see which is lesser and which is greater.
611+
612+
<p> The only significant difference between the two types is that “range” <a data-link-type=dfn href=#media-feature title="media features">media features</a>
613+
accept “min-” and “max-” prefixes on their name.
614+
Adding one of these prefixes changes the meaning—<wbr></wbr>rather than the <a data-link-type=dfn href=#media-feature title="media feature">media feature</a> being true when the feature exactly matches the given value,
615+
it matches when the feature is greater/less than or equal to the given value.
616+
617+
<div class=example>
618+
A <span class=css data-link-type=maybe title="(min-width: 600px)">(min-width: 600px)</span> <a data-link-type=dfn href=#media-feature title="media feature">media feature</a> is true
619+
when the viewport’s width is <span class=css data-link-type=maybe title=600px>600px</span> <em>or more</em>.
620+
621+
<p> On the other hand, <span class=css data-link-type=maybe title="(width: 600px)">(width: 600px)</span> by itself is only true
622+
when the viewport’s width is <em>exactly</em> <span class=css data-link-type=maybe title=600px>600px</span>.
623+
If it’s less or greater than <span class=css data-link-type=maybe title=600px>600px</span>, it’ll be false.
624+
</div>
625+
626+
<div class=example>
627+
On the other hand,
628+
<span class=css data-link-type=maybe title="(min-script: 1)">(min-script: 1)</span> is invalid,
629+
because <a class=property data-link-type=propdesc href=#descdef-script title=script>script</a> is a “discrete” <a data-link-type=dfn href=#media-feature title="media feature">media feature</a>,
630+
and so doesn’t accept the prefixes.
631+
(Even though the <a class=property data-link-type=propdesc href=#descdef-script title=script>script</a> <a data-link-type=dfn href=#media-feature title="media feature">media feature</a> appears to be numeric.)
632+
</div>
633+
634+
<h4 class="heading settled heading" data-level=2.4.2 id=mq-boolean-context><span class=secno>2.4.2 </span><span class=content>
596635
Evaluating A Media Feature in a Boolean Context</span><a class=self-link href=#mq-boolean-context></a></h4>
597636

598637
<p> While <a data-link-type=dfn href=#media-feature title="media features">media features</a> normally have a syntax similar to CSS properties,
@@ -1460,7 +1499,7 @@ <h2 class="no-num no-ref heading settled heading" id=index><span class=content>
14601499
<li>all, <a href=#valuedef-all title="section 2.3">2.3</a>
14611500
<li>aspect-ratio, <a href=#descdef-aspect-ratio title="section 4.6">4.6</a>
14621501
<li>aural, <a href=#valuedef-aural title="section 2.3">2.3</a>
1463-
<li>boolean context, <a href=#boolean-context title="section 2.4.1">2.4.1</a>
1502+
<li>boolean context, <a href=#boolean-context title="section 2.4.2">2.4.2</a>
14641503
<li>braille, <a href=#valuedef-braille title="section 2.3">2.3</a>
14651504
<li>coarse, <a href=#valuedef-coarse title="section 4.15">4.15</a>
14661505
<li>color, <a href=#descdef-color title="section 4.8">4.8</a>

mediaqueries/Overview.src.html

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,46 @@ <h3 id='mq-features'>
391391
</pre>
392392
</div>
393393

394+
<h4 id='mq-ranges'>
395+
Media Feature Types: “range” and “discrete”</h4>
396+
397+
Every media feature defines its “type” as either “range” or “discrete” in its definition table.
398+
399+
“Discrete” media features,
400+
like 'luminosity' or 'script',
401+
take their values from a set.
402+
The values may be keywords
403+
or boolean numbers (0 and 1),
404+
but the common factor is that there's no intrinsic “order” to them--
405+
none of the values are “less than” or “greater than” each other.
406+
407+
“Range” media features like 'width', on the other hand,
408+
take their values from a range.
409+
Any two values can be compared to see which is lesser and which is greater.
410+
411+
The only significant difference between the two types is that “range” <a>media features</a>
412+
accept “min-” and “max-” prefixes on their name.
413+
Adding one of these prefixes changes the meaning--
414+
rather than the <a>media feature</a> being true when the feature exactly matches the given value,
415+
it matches when the feature is greater/less than or equal to the given value.
416+
417+
<div class='example'>
418+
A ''(min-width: 600px)'' <a>media feature</a> is true
419+
when the viewport's width is ''600px'' <em>or more</em>.
420+
421+
On the other hand, ''(width: 600px)'' by itself is only true
422+
when the viewport's width is <em>exactly</em> ''600px''.
423+
If it's less or greater than ''600px'', it'll be false.
424+
</div>
425+
426+
<div class='example'>
427+
On the other hand,
428+
''(min-script: 1)'' is invalid,
429+
because 'script' is a “discrete” <a>media feature</a>,
430+
and so doesn't accept the prefixes.
431+
(Even though the 'script' <a>media feature</a> appears to be numeric.)
432+
</div>
433+
394434
<h4 id='mq-boolean-context'>
395435
Evaluating A Media Feature in a Boolean Context</h4>
396436

0 commit comments

Comments
 (0)