CSS Data Type
Description
The <resolution> CSS data type represents a measurement of the density of pixels or dots in a display device. It is most commonly used in media queries to determine the screen's sharpness or clarity, which can help developers adapt content for high-resolution displays such as Retina screens or print layouts. A <resolution> value can be expressed in units such as dots per inch (dpi), dots per centimeter (dpcm), or dots per pixel (dppx), allowing precise control over how content scales and renders across different devices.
One of the main applications of <resolution> is in responsive design, particularly when using the @media rule to apply styles conditionally based on the device's resolution. By detecting higher-density screens, you can serve higher-quality images, sharper icons, or adjust layouts to enhance readability and visual fidelity.
<resolution> also interacts with other length or ratio-based types. For example, it complements <length> when scaling graphics or typography proportionally to a device's pixel density. This ensures that visual elements maintain consistent physical dimensions regardless of the screen's pixel density.
Here are some code examples demonstrating the use of <resolution> in media queries:
/* Apply high-resolution images for devices with at least 2dppx */
@media (min-resolution: 2dppx) {
body {
background-image: url("high-res-background.png");
}
}
/* Apply different styles for print vs. screen resolution */
@media print and (min-resolution: 300dpi) {
body {
font-size: 12pt;
line-height: 1.5;
}
}
In these examples, the first query targets screens with a high pixel density, ensuring graphics appear crisp. The second query adapts typography for high-resolution print outputs, improving legibility. The <resolution> type is therefore a powerful tool in creating adaptive and visually consistent web designs across diverse devices.
Syntax
property: <resolution>;
Values
- dpiThis unit represents the number of dots per inch. A screen typically contains 72 or 96 dpi; a printed document usually reach much greater dpi. As 1 inch is 2.54 cm, 1dpi ≈ 2.54dpcm.
- dpcmThis unit represents the number of dots per centimeter. As 1 inch is 2.54 cm, 1dpcm ≈ 0.39dpi.
- dppxThis unit represents the number of dots per px unit. Due to the 1:96 fixed ratio of CSS in to CSS px, 1dppx is equivalent to 96dpi, that corresponds to the default resolution of images displayed in CSS as defined by the image-resolution property.
Example
Browser Support
The following information will show you the current browser support for the CSS resolution data type. Hover over a browser icon to see the version that first introduced support for this CSS data type.
This data type is supported in some modern browsers, but not all.
Desktop
Tablets & Mobile
Last updated by CSSPortal on: 3rd January 2026
