https://w3c.github.io/csswg-drafts/css-page-3/#valdef-page-size-length says that negative page sizes are invalid. It's interesting that zero is allowed there; obviously we can't print anything to a zero-sized page. But also, beyond that: positive size pages are just as problematic if the (default or author-specified) margins are large enough to consume all of the usable page area. Chrome seems to handle this gracefully by falling back to the system default page-size, or something like that, if the page content area is sufficiently close to zero in either axis. Specifically: (1) With zero margins, then the smallest length they'll accept (on my system, to 4 decimal places of precision) is `size: 0.0105in`. I can provide that as a page size and get an extremely small print-preview result, but e.g. `size 0.0104in` seems to be ignored and give me US Letter preview. Presumably that's due to a fixed-point representation like `nscoord` that rounds down to zero for sufficiently small lengths. (2) With nonzero margins -- e.g. the defaults or with explicit `margin: 2in` -- Chrome has the same graceful fallback. `margin: 2in; size: 4.0105in` does produce a tiny page, but if I reduce the size very slightly to `4.0104in` then they fall back to US Letter. Firefox instead produces a bunch of blank pages, which doesn't seem particularly useful. Perhaps we should implement the same graceful fallback if we can tell that the content area has literally zero area in some axis?
Bug 1807985 Comment 0 Edit History
Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.
https://w3c.github.io/csswg-drafts/css-page-3/#valdef-page-size-length says that negative page sizes are invalid. It's interesting that zero is allowed there; obviously we can't print anything to a zero-sized page. But also, beyond that: positive size pages are just as problematic if the (default or author-specified) margins are large enough to consume all of the usable page area. Chrome seems to handle this gracefully by falling back to the system default page-size, or something like that, if the page content area is sufficiently close to zero in either axis. Specifically: (1) With zero margins, then the smallest length they'll accept (on my system, to 4 decimal places of precision) is `size: 0.0105in`. I can provide that as a page size and get an extremely small print-preview result, but e.g. `size 0.0104in` seems to be ignored and give me US Letter preview. Presumably that's due to a fixed-point representation like `nscoord` that rounds down to zero for sufficiently small lengths. (2) With nonzero margins -- e.g. the defaults or with explicit `margin: 2in` -- Chrome has the same graceful fallback. `margin: 2in; size: 4.0105in` does produce a tiny page, but if I reduce the size very slightly to `4.0104in` then they fall back to US Letter. Firefox instead produces a bunch of blank pages, which doesn't seem particularly useful. Perhaps we should implement a similar graceful fallback (at used-value time, not necessarily at parse time) if we can tell that the content area has literally zero area in some axis?