The <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.
Syntax
The <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.
Units
dpi
- Represents the number of dots per inch. Screens typically contains 72 or 96 dots per inch, but the dpi for printed documents is usually much greater. As 1 inch is 2.54 cm,
1dpi ≈ 0.39dpcm
. dpcm
- Represents the number of dots per centimeter. As 1 inch is 2.54 cm,
1dpcm ≈ 2.54dpi
. dppx
- Represents the number of dots per
px
unit. Due to the 1:96 fixed ratio of CSSin
to CSSpx
,1dppx
is equivalent to96dpi
, which corresponds to the default resolution of images displayed in CSS as defined byimage-resolution
. x
- Alias for
dppx
.
Note: 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
, or 0dppx
.
Examples
Use in a media query
@media print and (min-resolution: 300dpi) { ... }
Valid resolutions
96dpi 50.82dpcm 3dppx
Invalid resolutions
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.
Specifications
Specification | Status | Comment |
---|---|---|
CSS Values and Units Module Level 4The definition of '<resolution>' in that specification. | Editor's Draft | Adds the x unit.
|
CSS Values and Units Module Level 3The definition of '<resolution>' in that specification. | Candidate Recommendation | Adds the dppx unit.
|
Media QueriesThe definition of '<resolution>' in that specification. | Recommendation | Initial definition. |
Browser compatibility
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Update compatibility data on GitHub
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
<resolution> | Chrome
Full support 29 |
Edge
Full support 12 |
Firefox Full support 8 |
IE
Full support 9 |
Opera
Full support 9.5 |
Safari No support No No support No Notes' See bug 78087. |
WebView Android
Full support ≤37 |
Chrome Android
Full support 29 |
Firefox Android Full support 8 |
Opera Android
Full support 10.1 |
Safari iOS No support No No support No Notes' See bug 78087. |
Samsung Internet Android
Full support 2.0 |
dpcm unit
|
Chrome
Full support 29 |
Edge
Full support 12 |
Firefox
Full support 8 |
IE
Full support 9 |
Opera Full support 16 Full support 16 No support 10 — 15 |
Safari
No support No |
WebView Android
Full support ≤37 |
Chrome Android
Full support 29 |
Firefox Android
Full support 8 |
Opera Android Full support 16 Full support 16 No support 10.1 — 14 |
Safari iOS
No support No |
Samsung Internet Android
Full support 2.0 |
dpi unit
|
Chrome
Full support 29 |
Edge
Full support 12 |
Firefox
Full support 8 |
IE
Full support 9 |
Opera Full support 16 Full support 16 No support 10 — 15 |
Safari
No support No |
WebView Android
Full support ≤37 |
Chrome Android
Full support 29 |
Firefox Android
Full support 8 |
Opera Android Full support 16 Full support 16 No support 10.1 — 14 |
Safari iOS
No support No |
Samsung Internet Android
Full support 2.0 |
dppx unit
|
Chrome
Full support 29 |
Edge
Full support 12 |
Firefox
Full support 16 |
IE
No support No |
Opera
Full support 12.1 |
Safari
No support No |
WebView Android
Full support ≤37 |
Chrome Android
Full support 29 |
Firefox Android
Full support 16 |
Opera Android
Full support 12.1 |
Safari iOS
No support No |
Samsung Internet Android
Full support 2.0 |
x unit
|
Chrome
Full support 68 |
Edge
Full support 79 |
Firefox
Full support 62 |
IE
No support No |
Opera
Full support 55 |
Safari
No support No |
WebView Android
Full support 68 |
Chrome Android
Full support 68 |
Firefox Android
Full support 62 |
Opera Android
Full support 48 |
Safari iOS
No support No |
Samsung Internet Android
Full support 10.0 |
Legend
- Full support
- Full support
- No support
- No support
- See implementation notes.'
- See implementation notes.
See also
- resolution media feature
- Using @media queries
<resolution> by Mozilla Contributors is licensed under CC-BY-SA 2.5.