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
|
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="description"
content="The box positions should account for the 10pt body margin and
padding">
<style>
@page {
size: 400pt 300pt;
margin: 50pt;
}
html {
font-family: sans-serif;
font-size: 12pt;
}
body {
position: static;
margin: 10pt;
padding: 10pt;
outline: thin solid rgb(0, 0, 0, 0.25);
}
div {
position: absolute;
width: 98pt;
height: 98pt;
border: solid red;
}
.zero {
top: 0;
bottom: auto;
left: 0;
right: auto;
margin: auto;
}
.static {
top: auto;
left: auto;
right: auto;
bottom: auto;
margin: auto;
}
.center {
top: 0;
bottom: 0;
left: 0;
right: 0;
margin: auto;
}
.percentage {
top: 0;
bottom: 0;
left: 0;
right: 0;
width: 65%;
height: 65%;
margin: auto;
}
.auto {
top: auto;
bottom: auto;
left: auto;
right: auto;
width: auto;
height: auto;
margin: auto;
}
.bottom-left {
bottom: 0;
left: 0;
}
.top-right {
top: 0;
right: 0;
}
.over-constrained {
left: 250pt;
right: 100pt;
top: 150pt;
bottom: 100pt;
width: 98pt;
height: 98pt;
margin: auto;
}
</style>
</head>
<body>
<div class="zero">Top left</div>
<div class="static">Auto position</div>
<div class="center">Auto margins</div>
<div class="percentage">Percentage size</div>
<div class="auto bottom-left">Auto dimensions + bottom left</div>
<div class="auto top-right">Auto dimensions + top right</div>
<div class="over-constrained">Over-constrained</div>
</body>
</html>
|