CKTIS / CSS
in — the CSS inch length unit
The `in` unit represents a CSS inch: `1in = 96px = 2.54cm`. It is an absolute length unit, but it does not guarantee a physical one-inch measurement on a screen.
Version: CSS modules; structured CSSWG indexes reconciled with pinned MDN BCD; Chromium 152 scope gate, per-example verification still required
Syntax
<number>inin is an absolute unit of the <length> type. Write it directly after a number without a space, for example 1in or 0.25in.
The conversion is fixed: 1in = 96px = 2.54cm. These are CSS pixels, not necessarily device pixels. On a screen, a length of 1in need not match a physical inch measured with a ruler.
For typical printing, the specification recommends anchoring physical units to real measurements. However, do not use an on-screen ruler measurement as a test of correct CSS conversion.
The example sets width: 1in and height: 0.25in. The expected content dimensions are 96px and 24px, respectively; inspect them using the browser's developer tools.
Examples
<!doctype html>
<html lang="en">
<meta charset="utf-8">
<title>CSS in unit</title>
<style>
.sample {
width: 1in;
height: 0.25in;
background: teal;
}
</style>
<div class="sample"></div>
</html>Result
A teal rectangle with a content width of 96 CSS px and a content height of 24 CSS px.
The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.