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
Rewrite image-resolution to talk about 'intrinsic resolution' rather than requiring the UA to render at a particular resolution, since that's wrong any time the image isn't intrinsically sized
<td>as specified, except with <resolution> possibly altered
1345
+
by computing for ''snap'' (see below)
1361
1346
</table>
1362
1347
1363
-
<p>The 'image-resolution' property specifies the resolution of all images used
1364
-
in or on the element: images in content (e.g. replaced elements and generated
1365
-
content), background images, list markers, etc. Values have the following
1366
-
meanings:</p>
1348
+
<p>The 'image-resolution' property specifies the intrinsic resolution of all
1349
+
raster images used in or on the element. (As vector formats such as SVG do
1350
+
not have an intrinsic resolution, this property has no effect on vector
1351
+
images.) The <dfn>intrinsic resolution</dfn> of an image is used to determine
1352
+
the image's <i>intrinsic size</i>. Affected images include images in the
1353
+
element's content (e.g. replaced elements and/or generated content),
1354
+
background images,list markers, etc.
1355
+
Values have the following meanings:</p>
1367
1356
1368
1357
<dl>
1369
-
<dt>from-image</dt>
1370
-
<dd>The image must be rendered at the image's native resolution. If the image does not have a native resolution or the UA cannot determine it, the image must instead be rendered at the specified resolution (see the following value). If a resolution is not specified, the image must be rendered at ''1dppx'' (the default resolution).</dd>
1371
-
1372
1358
<dt><resolution></dt>
1373
-
<dd>If the "from-image" keyword is not specified, or it is specified and the native resolution cannot be determined, the image must be rendered at the specified resolution.</dd>
1359
+
<dd>Specifies the intrinsic resolution explicitly.</dd>
1360
+
1361
+
<dt>from-image</dt>
1362
+
<dd>The image's intrinsic resolution is taken as that specified by the
1363
+
image format. If the image does not specify its own resolution, the
1364
+
explicitly specified resolution is used (if given), else it defaults to
1365
+
''1ddpx''.</dd>
1374
1366
1375
1367
<dt>snap</dt>
1376
-
<dd>If the "snap" keyword is provided, and the specified resolution is such that one image pixel would be larger than one device pixel, the image must be rendered at the specified resolution, rounded to the nearest value that would map one image pixel to an integer number of device pixels. Otherwise, the image must be rendered at the specified resolution, rounded to the nearest value that would map an integer number of image pixels to one device pixel.</dd>
1368
+
<dd>If the "snap" keyword is provided, the computed ''<resolution>''
1369
+
(if any) is the specified resolution rounded to the nearest value that
1370
+
would map one image pixel to an integer number of device pixels.
1371
+
If the resolution is taken from the image, then the used intrinsic
1372
+
resolution is the image's native resolution similarly adjusted.</dd>
1377
1373
</dl>
1378
1374
1379
-
<p>This property must have no effect on vector images, as vector images
1380
-
do not have a concept of "resolution".</p>
1375
+
<divclass='example'>
1376
+
<p>Printers tend to have substantially higher resolution than computer
1377
+
monitors; due to this, an image that looks fine on the screen may look
1378
+
pixellated when printed out.
1379
+
The 'image-resolution' property can be used to embed a high-resolution
1380
+
image into the document and maintain an appropriate size, ensuring
1381
+
attractive display both on screen and on paper:</p>
1382
+
1383
+
<preclass='css'><code>
1384
+
img.high-res {
1385
+
image-resolution: 300dpi;
1386
+
}</code></pre>
1387
+
1388
+
<p>With this set, an image meant to be 5 inches wide at 300dpi will actually
1389
+
display as 5in wide; without this set, the image would display as approximately 15.6in
1390
+
wide since the image is 15000 image pixels across, and by default CSS displays 96 image pixels per
1391
+
inch.</p>
1392
+
</div>
1393
+
1381
1394
1382
1395
<divclass="example">
1383
-
<p>This rule specifies that the UA should use the image resolution
1396
+
<p>Some image formats can encode the image resolution into the image data.
1397
+
This rule specifies that the UA should use the image resolution
1384
1398
found in the image itself, falling back to 1 image pixel per CSS
<p>These rules both specify that the UA should use the image resolution
1404
+
found in the image itself, but if the image has no resolution, the
1405
+
resolution is set to 300dpi instead of the default ''1dppx''.</p>
1406
+
1407
+
<pre>
1408
+
img { image-resolution: from-image 300dpi }
1409
+
img { image-resolution: 300dpi from-image }
1410
+
</pre>
1411
+
1388
1412
</div>
1389
1413
1390
1414
<divclass="example">
1391
-
<p>Using this rule, the image resolution is set to 300dpi and the
1392
-
resolution in the image, if any, is ignored.</p>
1415
+
<p>Using this rule, the image resolution is set to 300dpi. (The
1416
+
resolution in the image, if any, is ignored.)</p>
1393
1417
1394
1418
<pre>img { image-resolution: 300dpi }</pre>
1395
1419
1396
-
<p>This rule, on the other hand, if used when the screen's resolution is 96dpi, would instead render the image at 288dpi (so that 3 image pixels map to 1 device pixel):</p>
1420
+
<p>This rule, on the other hand, if used when the screen's resolution
1421
+
is 96dpi, would instead render the image at 288dpi (so that 3 image
1422
+
pixels map to 1 device pixel):</p>
1397
1423
1398
1424
<pre>img { image-resolution: 300dpi snap; }</pre>
1399
-
</div>
1400
-
1401
-
1402
-
<divclass="example">
1403
-
<p>These rules both specify that the UA should use the image resolution
1404
-
found in the image itself. If the image has no resolution, the
1405
-
resolution is set to 300dpi.</p>
1406
1425
1407
-
<pre>
1408
-
img { image-resolution: from-image 300dpi }
1409
-
img { image-resolution: 300dpi from-image }
1410
-
</pre>
1426
+
<p>The ''snap'' keyword can also be used when the resolution is taken
0 commit comments