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: Margins on cleared blocks that contain 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/064.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 .outer { margin: 1em; background: red; height: 4.5em; }
10 .border { border: solid; width: 10em; }
11 .box { margin: 0; background: yellow; }
12 .float { margin: 0; width: 5em; height: 1.5em; background: orange; float: right; }
13 .clear { margin-top: 3em; height: 1.5em; background: aqua; clear: both; }
14 .control { border: solid; width: 10em; background: yellow; margin: 1em; }
15 .control .a { margin: 0 0 0 auto; width: 5em; height: 1.5em; background: orange; }
16 .control .b { margin-top: 1.5em; height: 1.5em; background: aqua; }
17 </style>
18 </head>
19 <body>
20 <p>The following two boxes should be identical, with no red present.</p>
21 <div class="outer border">
22 <div class="box">
23 <div class="float">TEST</div>
24 <div class="clear">TEST</div>
25 </div>
26 </div>
27 <div class="control">
28 <div class="a">TEST</div>
29 <div class="b">TEST</div>
30 </div>
31
32 </body>
33 </html>