c412-blockw-000

Horizontal Formatting

WeasyPrint

This browser

Flags
ahem, image

Source

 1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
 2 <html>
 3  <head>
 4   <title>CSS Test: Horizontal Formatting</title>
 5   <meta name="flags" content="ahem image">
 6   <link rel="help" href="http://www.w3.org/TR/REC-CSS1#horizontal-formatting">
 7   <link rel="author" title="CSS1 Test Suite Contributors" href="http://www.w3.org/Style/CSS/Test/CSS1/current/tsack.html">
 8   <link rel="author" title="Ian Hickson" href="mailto:ian@hixie.ch">
 9   <style type="text/css">
10    .test { font: 10px/1 Ahem; margin: 1em; border: solid 1em; width: 100px; background: red no-repeat; color: green; }
11    .test p, .test div { margin-top: 0; margin-bottom: 0; }
12    .test.a { background-image: url(support/css1test412b-a.png); }
13    .test.b { background-image: url(support/css1test412b-b.png); }
14    .test.b p { background-color: green; }
15    p.one {margin-left: 10px;}
16    div.two {margin-left: 10px;}
17    p.three {margin-left: 0; width: 50%; margin-right: auto;}
18    p.four {margin-left: auto; width: 50%; margin-right: auto;}
19    p.five {margin-left: auto; width: 50%; margin-right: 0;}
20    p.six {margin-left: auto; width: auto; margin-right: 0;}
21    p.seven {margin-left: 0; width: auto; margin-right: auto;}
22    p.eight {margin-left: auto; width: auto; margin-right: auto;}
23    p.nine {padding-left: auto; padding-right: auto; margin-left: 0; margin-right: 0; width: 50%;}
24    p.ten {margin-left: auto; width: 100%; margin-right: auto;}
25   </style>
26   <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#blockwidth" title="10.3.3 Block-level, non-replaced elements in normal flow">
27   <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#the-width-property" title="10.2 Content width: the 'width' property">
28   <link rel="help" href="http://www.w3.org/TR/CSS21/box.html#margin-properties" title="8.3 Margin properties: 'margin-top',  'margin-right',  'margin-bottom', 'margin-left', and 'margin'">
29  </head>
30  <body>
31   <p>There should be no red below, just two green squares.</p>
32   <div class="test a"> <!-- this tests the text alignment -->
33    <p class="one"> X </p>
34    <div class="two">
35     <p class="one"> X </p>
36    </div>
37    <p class="three"> X </p>
38    <p class="four"> X </p>
39    <p class="five"> X </p>
40    <p class="six"> X </p>
41    <p class="seven"> X </p>
42    <p class="eight"> X </p>
43    <p class="nine"> X </p>
44    <p class="ten"> X </p>
45   </div>
46   <div class="test b"> <!-- this tests the size of the content area -->
47    <p class="one"> X </p>
48    <div class="two">
49     <p class="one"> X </p>
50    </div>
51    <p class="three"> X </p>
52    <p class="four"> X </p>
53    <p class="five"> X </p>
54    <p class="six"> X </p>
55    <p class="seven"> X </p>
56    <p class="eight"> X </p>
57    <p class="nine"> X </p>
58    <p class="ten"> X </p>
59   </div>
60  </body>
61 </html>