Re: [csswg-drafts] [css-page][css-env] Expose unprintable areas via CSS (#11395)

Following up on my previous comment & its alternate approach with a `enforce-safe-margins` descriptor -- I can imagine it having  several useful values:
* `none`: default, what browsers do right now (don't apply any lower-bound on the author-specified margins)
* `minimum`: for each side, use **that side's** safe margin as a lower-bound on the author-specified `margin: ...` values.
* `balanced`: use the **largest of the safe insets** (essentially the `safe-printable-inset`) as a lower-bound **for all 4 sides** of the author-specified margins.  (So e.g. if an author has specified `margin: 0.1in`, and the user's printer has its largest safe-inset of `0.2in` on the bottom edge, then the printout will end up with `0.2in` on all sides.)
* `additive`: This is an optional modifier that says whether the safe-insets are to be treated as a lower-bound vs. something to be added to the author-specified `margin` values (if that's useful to do).
 
That lets you achieve the same outcome as `calc(env(unprintable-area-width) + 50px)` in the first comment here, via `@page { margin: 50px; enforce-safe-margins: balanced additive}` for example.


Compared to the `env` approach, this^ design has the benefit that the actual determination of the safe-margin-amount can happen at used-value-time, when the UA has knowledge of *both* the author's `@page { size: ... ` value *and* the output paper-size (which might be wildly different).  This gives the UA the flexibility to apply a safe margin that's **actually safe** even-in-the-face-of-possible-downscaling (if the content has a large `@page { size: ...}` value) instead of being forced to promise in advance that a particular margin (e.g. 0.2in) will be safe only to have it downscaled to a smaller not-so-safe amount (e.g. if the author specifies a `@page` size that's twice as large as the output medium).

 (The names are all examples right now & open to bikeshedding if we decide this is a good route to pursue.)

-- 
GitHub Notification of comment by dholbert
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/11395#issuecomment-3029150700 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Wednesday, 2 July 2025 20:00:06 UTC