1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126
|
<!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>
|