Re: [csswg-drafts] [css-page] Consider making 'size' a legacy alias of a new descriptor ('page-size')? (#11925)

This is a great opportunity to give it a more descriptive name.

See https://drafts.csswg.org/css-page-3/#page-size-prop (oh hai, it's already `#page-size-prop` , oh well).

> This property specifies the target size and orientation of the [page box](https://drafts.csswg.org/css-page-3/#page-box)’s containing block.

Although "page-size" is ambiguous (is it the page box size or the page area size?), it doesn't even set the page size. It sets the size of the *containing block* of the page box, which becomes interesting if the page area is sized with percentages (also if page margins use percentages, of course).

```css
  @page {
    size: 300px;
    margin: 100px;
    width: 50%;
    background: cyan;
  }
  body {
    margin: 0;
    background: yellow;
  }
```

The page area width becomes 150px (50% of 300px). The page box width becomes 350px (150px + page margins). Further explanation: https://drafts.csswg.org/css-page-3/#page-model

> The [containing block](https://drafts.csswg.org/css-page-3/#containing-block) of the page box is specified using the size property in the [page context](https://drafts.csswg.org/css-page-3/#page-context). The width and horizontal margins of the page box are then calculated exactly as for a [non-replaced block element in normal flow](https://www.w3.org/TR/CSS2/visudet.html#blockwidth). [[CSS2]](https://drafts.csswg.org/css-page-3/#biblio-css2) The height and vertical margins of the page box are calculated analogously (instead of using the block height formulas). In both cases if the values are over-constrained, instead of ignoring any margins, the containing block is resized to coincide with the margin edges of the page box.

I don't know what a good name would be. Just pointing out that `page-size` isn't great. But neither was `size`, of course. :)

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


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

Received on Thursday, 13 March 2025 09:34:15 UTC