You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
devices with viewport (the part of the screen/paper where the
1240
1240
document is rendered) widths between 400 and 700 pixels:
1241
1241
1242
-
<pre>@media screen and (min-width: 400px) and (max-width: 700px) { … }</pre></div>
1242
+
<pre>@media (min-width: 400px) and (max-width: 700px) { … }</pre></div>
1243
1243
1244
1244
<divclass=example>
1245
1245
This media query expresses that style sheet is usable on screen
1246
1246
and handheld devices if the width of the viewport is greater than
1247
1247
20em.
1248
1248
1249
-
<pre>@media handheld and (min-width: 20em),
1250
-
screen and (min-width: 20em) { … }
1251
-
</pre>
1252
-
<p> The <spanclass=cssdata-link-type=maybetitle=em>em</span> value is relative to the initial value of
1253
-
‘font-size’.
1249
+
<pre>@media (min-width: 20em) { … }</pre>
1250
+
<p> The <spanclass=cssdata-link-type=maybetitle=em>em</span> value is relative to the initial value of <aclass=propertydata-link-type=propdeschref=http://dev.w3.org/csswg/css-fonts-3/#propdef-font-sizetitle=font-size>font-size</a>.
<p> A specified <aclass="production css-code" data-link-type=typehref=http://dev.w3.org/csswg/css-values-3/#length-valuetitle="<length>"><length></a> cannot be negative.
1302
1299
1303
1300
<divclass=example>
1304
-
<pre>@media screen and (device-width: 800px) { … }</pre>
1305
-
<p> In the example above, the style sheet will apply only to screens
1306
-
that currently displays exactly 800 horizontal pixels. The <spanclass=cssdata-link-type=maybetitle=px>px</span>unit is
1307
-
of the logical kind, as described in the <ahref=#units>Units</a>
1308
-
section.
1301
+
<pre>@media (device-width < 800px) { … }</pre>
1302
+
<p> In the example above, the style sheet will apply only to screens
1303
+
less than <spanclass=cssdata-link-type=maybetitle=800px>800px</span>in length.
1304
+
The <spanclass=cssdata-link-type=maybetitle=px>px</span> unit is of the logical kind,
1305
+
as described in the <ahref=#units>Units</a>section.
1309
1306
</div>
1310
1307
1311
1308
<pclass=note> Note: If a device can be used in multiple orientations,
<p> The <aclass=propertydata-link-type=propdeschref=#descdef-gridtitle=grid>grid</a> media feature is used to query whether the output device
1446
-
is grid or bitmap. If the output device is grid-based (e.g., a "tty"
1447
-
terminal, or a phone display with only one fixed font), the value will
1448
-
be 1. Otherwise, the value will be 0.
1442
+
<p> The <aclass=propertydata-link-type=propdeschref=#descdef-gridtitle=grid>grid</a> media feature is used to query whether the output device is grid or bitmap.
1443
+
If the output device is grid-based
1444
+
(e.g., a "tty" terminal, or a phone display with only one fixed font),
1445
+
the value will be 1.
1446
+
Otherwise, the value will be 0.
1449
1447
1450
1448
<divclass=example>
1451
-
Here is an example:
1449
+
Here is an example that detects a narrow console screen:
1452
1450
1453
-
<pre>@media handheld and (grid) and (max-width: 15em) { … }
0 commit comments