v150 · css · print
Expose unprintable areas via CSS
Chrome 150 exposes printer hardware margins — the strip of paper at each edge that the printer's feed mechanism cannot reliably mark — as CSS environment variables, letting print stylesheets account for these areas without relying on hard-coded margin values.
at a glance
| Shipped in | Chrome 150 (Enabled by default) |
|---|---|
| Status | Enabled by default |
| Spec | CSS Paged Media Level 3 §page-margin-safety |
| Standards position (Firefox) | Positive |
| Standards position (Safari) | No signal |
| ChromeStatus | 5515971464527872 — Expose unprintable areas via CSS |
why it exists
Every printer has a small "safety margin" — an unprintable strip around the edges of the paper caused by the paper-handling mechanism gripping or feeding the sheet. The default CSS page margins are expected to be larger than these strips so content doesn't fall into the unprintable zone. In practice, web print stylesheets either use fixed oversized margins (wasting paper) or risk clipping near the edges on printers with larger hardware margins.
By exposing the actual hardware margins as CSS environment variables, print stylesheets can set margins to exactly the hardware limit, avoiding both waste and clipping. The values are read-only and device-specific; they are 0 in non-print media.
shape of the API
Four new CSS environment variables, available inside @page rules and print stylesheets:
| Variable | Description |
|---|---|
env(page-margin-safety-top) | Unprintable strip at the top edge |
env(page-margin-safety-right) | Unprintable strip at the right edge |
env(page-margin-safety-bottom) | Unprintable strip at the bottom edge |
env(page-margin-safety-left) | Unprintable strip at the left edge |
The values are <length>s (e.g. 4mm). They are 0px in screen media. The exact variable names are as defined in the CSS Paged Media spec draft; check the spec for any renames before the standard is final.
example
@media print {
@page {
/* Use the hardware margin as the minimum margin on each side */
margin-top: max(12mm, env(page-margin-safety-top, 4mm));
margin-right: max(10mm, env(page-margin-safety-right, 4mm));
margin-bottom: max(12mm, env(page-margin-safety-bottom, 4mm));
margin-left: max(10mm, env(page-margin-safety-left, 4mm));
}
body {
font-size: 11pt;
line-height: 1.4;
}
}
Source: CSS Paged Media Level 3
browser support
| Browser | Support | Notes |
|---|---|---|
| Chrome 150+ | Enabled by default | All platforms with printing support |
| Firefox | Positive signal | Not yet shipped |
| Safari | No signal | — |