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
|
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="description"
content="The width of the red floating boxes should be calculated as
shrink-to-fit. The boxes with multi-line text should span the entire width">
<style>
@page {
size: 400pt 450pt;
margin: 50pt;
}
html {
font-family: sans-serif;
font-size: 14pt;
line-height: 18pt;
}
div {
clear: both;
}
span {
margin: 5pt 0;
outline: solid red;
}
.left {
float: left;
}
.right {
float: right;
}
</style>
</head>
<body>
<div>float: left</div>
<span class="left">Lorem ipsum</span>
<div>float: right</div>
<span class="right">Lorem ipsum</span>
<div>float: left with multi-line text</div>
<span class="left">Lorem ipsum dolor sit amet, consectetur adipisici elit,
sed eiusmod tempor incidunt ut labore et dolore magna aliqua.</span>
<div>float: right with multi-line text</div>
<span class="right">Lorem ipsum dolor sit amet, consectetur adipisici elit,
sed eiusmod tempor incidunt ut labore et dolore magna aliqua.</span>
<div>float: right with long words</div>
<span class="right">loooooooooooooooooooooooong woooooooooooooooooords</span>
</body>
</html>
|