From b08c939df33836317c0b9428ffda1bc5f86e30dd Mon Sep 17 00:00:00 2001 From: Morten Stenshorne Date: Mon, 8 Dec 2025 15:19:35 +0100 Subject: [PATCH] Proposed spec changes for safe printable insets. See https://github.com/w3c/csswg-drafts/issues/11395#issuecomment-3546009354 --- css-page-3/Overview.bs | 69 +++++++++++++++++++++++++++++++++++++++--- 1 file changed, 65 insertions(+), 4 deletions(-) diff --git a/css-page-3/Overview.bs b/css-page-3/Overview.bs index e5170f7ae5c..16a9f573e11 100644 --- a/css-page-3/Overview.bs +++ b/css-page-3/Overview.bs @@ -1258,7 +1258,7 @@ properties: is larger than the height of the top page margin, then any ''margin-top/auto'' values for 'margin-top' or 'margin-bottom' are, for the following rules, - treated as zero. + treated as <>.
  • If at this point all of 'height', 'margin-top', and 'margin-bottom' @@ -1271,14 +1271,20 @@ properties: follows from the equality.
  • - If 'height' is set to ''height/auto'', any other auto values become ''0'' and - 'height' follows from the resulting equality + If 'height' is set to ''height/auto'', any auto margin + values become <> and 'height' follows from the + resulting equality.
  • If both 'margin-top' and 'margin-bottom' are ''margin-top/auto'', - their used values are equal. + their used values become equal. This vertically centers the page-margin box content within the top page margin. + If <> is not ''0'' here, an additional adjustment step + is performed: If the resulting 'margin-top' in the previous step became + less than <>, subtract as much as possible of this + difference from 'margin-bottom' without making it negative. Then add + this value to 'margin-top'. The same rules apply to the bottom page-margin boxes (bottom-left-corner, @@ -2060,6 +2066,61 @@ Positioning the page box on the sheet The user agent may wish to consult the user in this regard. +

    +Staying within the printable area: the '@page/page-margin-safety' property

    + +
    +	Name: page-margin-safety
    +	For: @page
    +	Value: none | clamp | add
    +	Initial: auto
    +	Computed Value: as specified
    +	
    + + Most printers have a small region along each edge of the page sheet + which is unprintable, typically due to the printer's paper handling + mechanism. This property can be used to help staying within the + printable area, by adjusting the page margins and page margin box + margins. + + Some printers don't have a uniform unprintable area width along each of + the four paper edges, and the printer may rotate the print output at + their own discretion. The user agent may therefore not be able to make + assumptions about which edge will be fed first into the printer, or what + orientation the sheet of paper has. If the user agent cannot make such + assumptions, only one will be provided (to be used on all 4 sides): The + larger of these four values. Otherwise, if the user agent can trust that + the four values are usable individually, and that no rotation is going + to take place, and so on, each side of the page may have individual + values. + + Let this value be <>, which is a <>. + + This property only affects margins that are adjacent to one of the edges + of a sheet. For all other margins, i.e. those margins facing the + page's page area, its value is 0. In other words, when + page-margin-safety is specified in a margin context, it will only have + an effect at one or two sides. For instance, @page { @top-right-corner { + page-margin-safety: clamp; } } may only clamp top and right margin + values, as the bottom and left margins face the document's contents, not + the page's edges. + +
    +
    none
    +
    Margins are not affected by unprintable regions
    +
    clamp
    +
    + The used margin values will be the maximum of the + resolved value, and <> for the + given side. +
    +
    add
    +
    + The used margin values will be the resolved value, plus + <> for the given side. +
    +
    +