margin-collapse-125

Margin Collapsing: clear (on a self-collapsing block with a margin)

WeasyPrint

This browser

Source

 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 (on a self-collapsing block with a margin)</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/025.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; vertical-align: top; }
10    .comparator { border-spacing: 1em; }
11    .test, .control { border: solid; background: red; }
12    .test .container { display: block; margin: 0; width: 8em; background: lime; }
13    .test .float { float: left; margin: 0; height: 4em; width: 4em; background: aqua; }
14    .test .clear { clear: left; display: block; background: red; margin: 2em 0; }
15    .test .block { display: block; margin: 1em 0 0; border-top: 2em solid yellow; }
16    .control .square { height: 4em; width: 4em; }
17    .control .rectangle { height: 2em; width: 8em; }
18    .control .lime { background: lime; }
19    .control .aqua { background: aqua; }
20    .control .yellow { background: yellow; }
21   </style>
22  </head>
23  <body>
24   <p>The following two boxes should be identical.</p>
25   <table class="comparator">
26    <tr>
27     <td class="test">
28      <div class="container">
29       <div class="float"> </div>
30       <div class="clear"> </div>
31       <div class="block"> </div>
32      </div>
33     </td>
34     <td class="control">
35      <table>
36       <tr>
37        <td class="square aqua"></td>
38        <td class="square lime"></td>
39       </tr>
40       <tr>
41        <td colspan="2" class="rectangle yellow"></td>
42       </tr>
43      </table>
44     </td>
45    </tr>
46   </table>
47  
48 
49 </body>
50 </html>