CKTIS / CSS
dpi — resolution unit
The dpi unit measures dots per CSS inch. It belongs to the <resolution> type, not the length type, and can be used to query pixel density in media queries.
Version: CSS modules; structured CSSWG indexes reconciled with pinned MDN BCD; Chromium 152 scope gate, per-example verification still required
Syntax
<number>dpidpi means dots per CSS inch and belongs to the <resolution> type. The number immediately precedes the unit, as in 192dpi; 192 dpi does not form a single value of this type. Negative values are not allowed.
Conversions are fixed: 96dpi = 1dppx, 192dpi = 2dppx, and 2.54dpi = 1dpcm. The unit describes density, not length: width: 192dpi is invalid.
In the example, (min-resolution: 192dpi) includes the threshold and higher values. The paragraph is green when it matches and black below the threshold. The query accounts for page zoom, so its result should not be treated as a measurement of the screen's physical density. Using dpi does not itself change the device's resolution.
Examples
<!doctype html>
<html lang="en">
<meta charset="utf-8">
<title>dpi example</title>
<style>
p { color: black; }
@media (min-resolution: 192dpi) {
p { color: green; }
}
</style>
<p>Resolution test</p>
</html>Result
Resolution test
The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.