<resolution>
CSS
data type
, used for describing
resolutions
in
media queries
, denotes the pixel density of an output device, i.e., its resolution.
On screens, the units are related to CSS inches, centimeters, or pixels, not physical values.
<resolution>
data type consists of a strictly positive
<number>
followed by one of the units listed below. As with all CSS dimensions, there is no space between the unit literal and the number.
dpi
1dpi ≈ 0.39dpcm
.
dpcm
1dpcm ≈ 2.54dpi
.
dppx
px
unit. Due to the 1:96 fixed ratio of CSS
in
to CSS
px
,
1dppx
相当于
96dpi
, which corresponds to the default resolution of images displayed in CSS as defined by
image-resolution
.
x
dppx
.
注意:
Although the number
0
is always the same regardless of unit, the unit may not be omitted. In other words,
0
is invalid and does not represent
0dpi
,
0dpcm
,或
0dppx
.
@media print and (min-resolution: 300dpi) { ... }
96dpi 50.82dpcm 3dppx
72 dpi Spaces are not allowed between the number and the unit. ten dpi The number must use digits only. 0 The unit is required.
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| <resolution> | Chrome 完整支持 29 | Edge 完整支持 12 |
Firefox
完整支持
8
|
IE 完整支持 9 | Opera 完整支持 9.5 |
Safari
不支持
No
注意事项
|
WebView Android 完整支持 ≤37 | Chrome Android 完整支持 29 |
Firefox Android
完整支持
8
|
Opera Android 完整支持 10.1 |
Safari iOS
不支持
No
注意事项
|
Samsung Internet Android 完整支持 2.0 |
dpcm
unit
|
Chrome 完整支持 29 | Edge 完整支持 12 | Firefox 完整支持 8 | IE 完整支持 9 |
Opera
完整支持
16
|
Safari 不支持 No | WebView Android 完整支持 ≤37 | Chrome Android 完整支持 29 | Firefox Android 完整支持 8 |
Opera Android
完整支持
16
|
Safari iOS 不支持 No | Samsung Internet Android 完整支持 2.0 |
dpi
unit
|
Chrome 完整支持 29 | Edge 完整支持 12 | Firefox 完整支持 8 | IE 完整支持 9 |
Opera
完整支持
16
|
Safari 不支持 No | WebView Android 完整支持 ≤37 | Chrome Android 完整支持 29 | Firefox Android 完整支持 8 |
Opera Android
完整支持
16
|
Safari iOS 不支持 No | Samsung Internet Android 完整支持 2.0 |
dppx
unit
|
Chrome 完整支持 29 | Edge 完整支持 12 | Firefox 完整支持 16 | IE 不支持 No | Opera 完整支持 12.1 | Safari 不支持 No | WebView Android 完整支持 ≤37 | Chrome Android 完整支持 29 | Firefox Android 完整支持 16 | Opera Android 完整支持 12.1 | Safari iOS 不支持 No | Samsung Internet Android 完整支持 2.0 |
x
unit
|
Chrome 完整支持 68 | Edge 完整支持 79 | Firefox 完整支持 62 | IE 不支持 No | Opera 完整支持 55 | Safari 不支持 No | WebView Android 完整支持 68 | Chrome Android 完整支持 68 | Firefox Android 完整支持 62 | Opera Android 完整支持 48 | Safari iOS 不支持 No | Samsung Internet Android 完整支持 10.0 |
完整支持
不支持
见实现注意事项。
<angle-percentage>
<angle>
<basic-shape>
<blend-mode>
<custom-ident>
<dimension>
<frequency-percentage>
<frequency>
<gradient>
<image>
<integer>
<length-percentage>
<length>
<number>
<percentage>
<ratio>
<resolution>
<shape>
<string>
<time-percentage>
<time>
<transform-function>
<url>
color
flex
ident
position