1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2 <html lang="en">
3 <head>
4 <title>CSS Test: Margin Collapsing: clear with no floats</title>
5 <link rel="author" title="Ian Hickson" href="mailto:ian@hixie.ch">
6 <link rel="alternate" href="http://www.hixie.ch/tests/adhoc/css/box/block/margin-collapse/034.html" type="text/html">
7 <link rel="help" href="http://www.w3.org/TR/CSS21/box.html#collapsing-margins">
8 <style type="text/css">
9 table, td { padding: 0; border-spacing: 0; }
10 .comparator { border-spacing: 1em; }
11 .test, .control { border: solid; background: red; }
12
13 .test .container { display: block; background: yellow; margin: 0; width: 8em; }
14 .test .block { display: block; border-top: 1em solid lime; margin: 0 0 0 0; }
15 .test .clear { display: block; border-top: 1em solid green; margin: 1em 0 0 0; clear: right; }
16
17 .control .lime { background: lime; height: 1em; width: 8em; }
18 .control .yellow { background: yellow; height: 1em; width: 8em; }
19 .control .green { background: green; height: 1em; width: 8em; }
20
21 </style>
22 </head>
23 <body>
24 <p>The following three rectangles should be identical, with no red present.</p>
25 <table class="comparator">
26 <tr>
27 <td class="test">
28 <div class="container">
29 <div class="block"> </div>
30 <div class="clear"> </div>
31 </div>
32 </td>
33 <td class="control">
34 <div class="lime"> </div>
35 <div class="yellow"> </div>
36 <div class="green"> </div>
37 </td>
38 </tr>
39 <tr>
40 <td class="control">
41 <div class="lime"> </div>
42 <div class="yellow"> </div>
43 <div class="green"> </div>
44 </td>
45 <td></td>
46 </tr>
47 </table>
48
49
50 </body>
51 </html>