Status: FAIL | Duration: 15ms | Subtests: 0/1 | Open test on wpt.live | Open ref on wpt.live | wpt.fyi
/css/css-page/margin-boxes/dimensions-004-print.html
<!DOCTYPE html> <link rel="author" title="Morten Stenshorne" href="mailto:mstensho@chromium.org"> <link rel="help" href="https://drafts.csswg.org/css-page-3/#margin-dimension"> <meta name="assert" content="Test auto lengths. Max content sizes are smaller than available size. With corners. No center/middle boxes."> <meta name="flags" content="ahem"> <link rel="stylesheet" type="text/css" href="/fonts/ahem.css"> <link rel="match" href="dimensions-004-print-ref.html"> <style> :root { print-color-adjust: exact; } @page { margin: 4em 5em 8em 7em; width: 20em; height: 15em; font: 16px/1 Ahem; white-space: pre-wrap; /* Corners just use all available size, if auto. */ @top-left-corner { writing-mode: vertical-rl; text-align: left; vertical-align: bottom; content: "x\ax"; border: solid thin; } @top-right-corner { text-align: left; vertical-align: top; content: "xx"; border: solid thin; } @bottom-right-corner { text-align: left; vertical-align: top; content: "xxx"; border: solid thin; } @bottom-left-corner { text-align: left; vertical-align: top; content: "xxxx"; border: solid thin; } /* Min/max width for top-left is 1em. For top-right it is 3em. Available space is 20em. Unused space becomes 16em. This will be distributed proportionally based on max widths. Left gets 1/4, right gets 3/4. Final widths become 1em+16em*1/4 = 5em for left, and 3em+16em*3/4 = 15em for right. */ @top-left { text-align: left; vertical-align: top; margin-bottom: 2em; content: "x"; background: hotpink; } @top-right { text-align: left; vertical-align: top; margin-top: 2em; content: "xxx"; background: yellow; } /* Min/max height for left-top is 3em (three lines). For left-bottom it is 2em (two lines). Available space is 15em. Unused space is 10em. This will be distributed proportionally based on max heights. Top gets 3/5, bottom gets 2/5. Final heights become 3em+10em*3/5 = 9em for top, and 2em+10em*2/5 = 6em for bottom. */ @left-top { text-align: left; vertical-align: top; margin-left: 4em; content: "x\ax\ax\a"; background: yellow; } @left-bottom { text-align: left; vertical-align: top; margin-right: 4em; content: "x\ax\a"; background: hotpink; } /* Min/max height for right-top is 2em (two lines). For right-bottom it is 1em (one line). Available space is 15em. Unused space is 12em. This will be distributed proportionally based on max heights. Top gets 2/3, bottom gets 1/3. Final heights become 2em+12em*2/3 = 10em for top, and 1em+12em*1/3 = 5em for bottom. */ @right-top { text-align: left; vertical-align: top; margin-left: 3em; content: "x\ax\a"; background: hotpink; } @right-bottom { text-align: left; vertical-align: top; margin-right: 3em; content: "xxx"; background: yellow; } /* Min/max width for bottom-left is 7em. For bottom-right it is 1em. Available space is 20em. Unused space becomes 12em. This will be distributed proportionally based on max widths. Left gets 7/8, right gets 1/8. Final widths become 7em+12em*7/8 = 17.5em for left, and 1em+12em*1/8 = 2.5em for right. */ @bottom-left { text-align: left; vertical-align: top; margin-top: 4em; content: "x x x x"; background: yellow; } @bottom-right { text-align: left; vertical-align: top; margin-bottom: 4em; content: "x"; background: hotpink; } } </style>
/css/css-page/margin-boxes/dimensions-004-print-ref.html
<!DOCTYPE html> <link rel="author" title="Morten Stenshorne" href="mailto:mstensho@chromium.org"> <meta name="flags" content="ahem"> <link rel="stylesheet" type="text/css" href="/fonts/ahem.css"> <style> html { font: 16px/1 Ahem; } @page { margin: 0; width: 32em; height: 27em; } :root { print-color-adjust: exact; } body { display: grid; grid-template-columns: 7em auto 5em; grid-template-rows: 4em auto 8em; height: 100vh; margin: 0; } .vertical-edge { display: flex; } .horizontal-edge { display: flex; flex-flow: column; } .corner { border: solid thin; } </style> <div class="corner">xx</div> <div class="vertical-edge"> <div style="width:5em; margin-bottom:2em; background:hotpink;">x</div> <div style="width:15em; margin-top:2em; background:yellow;">xxx</div> </div> <div class="corner">xx</div> <div class="horizontal-edge"> <div style="height:9em; margin-left:4em; background:yellow;">x<br>x<br>x</div> <div style="height:6em; margin-right:4em; background:hotpink;">x<br>x</div> </div> <div></div> <div class="horizontal-edge"> <div style="height:10em; margin-left:3em; background:hotpink;">x<br>x</div> <div style="height:5em; margin-right:3em; background:yellow;">xxx</div> </div> <div class="corner">xxxx</div> <div class="vertical-edge"> <div style="width:17.5em; margin-top:4em; background:yellow;">x x x x</div> <div style="width:2.5em; margin-bottom:4em; background:hotpink;">x</div> </div> <div class="corner">xxx</div>