CKTIS / CSS
dpcm — dots per centimeter
The CSS unit dpcm expresses resolution in dots per centimeter. It is used in contexts such as resolution media queries, rather than for specifying element lengths.
Version: CSS modules; structured CSSWG indexes reconciled with pinned MDN BCD; Chromium 152 scope gate, per-example verification still required
Syntax
<number>dpcmdpcm is a <resolution> unit: it means dots per CSS centimeter. Write the number immediately before the unit, for example 100dpcm. Negative values are invalid. This is a density unit, not a length unit—it cannot replace cm or px in width.
The conversion is 1dpcm = 2.54dpi, so 100dpcm = 254dpi. The unit dppx expresses dots per CSS pixel; 1dppx = 96dpi. These are different ways to express resolution, not element size.
In the example, (min-resolution: 100dpcm) means a resolution of at least 100dpcm, including the boundary. The body background is white below the threshold and lime at or above it. The result depends on the resolution reported by the browser; the query does not change the device resolution.
Examples
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Resolution media queries in dpcm</title>
<style>
@media (resolution < 100dpcm) {
body { background-color: white; }
}
@media (min-resolution: 100dpcm) {
body { background-color: lime; }
}
</style>
</head>
<body>
<p>The background is white below 100 dots per centimeter and lime at or above that resolution.</p>
<script>
// 100 dots per centimeter is 254 dots per inch.
const expected = matchMedia('(min-resolution: 254dpi)').matches
? 'rgb(0, 255, 0)'
: 'rgb(255, 255, 255)';
const actual = getComputedStyle(document.body).backgroundColor;
console.log(`100dpcm background matches the 254dpi threshold: ${actual === expected}`);
</script>
</body>
</html>Result
100dpcm background matches the 254dpi threshold: true
The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.