margin-collapse-122

Margin Collapsing: clear (simple)

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 (simple)</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/022.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; border: 2em solid yellow; margin-top: 1em; }
15    .control .square { height: 4em; width: 4em; }
16    .control .rectangle { height: 4em; width: 8em; }
17    .control .lime { background: lime; }
18    .control .aqua { background: aqua; }
19    .control .yellow { background: yellow; }
20   </style>
21  </head>
22  <body>
23   <p>The following two squares should be identical.</p>
24   <table class="comparator">
25    <tr>
26     <td class="test">
27      <div class="container">
28       <div class="float"> </div>
29       <div class="clear"> </div>
30      </div>
31     </td>
32     <td class="control">
33      <table>
34       <tr>
35        <td class="square aqua"></td>
36        <td class="square lime"></td>
37       </tr>
38       <tr>
39        <td colspan="2" class="rectangle yellow"></td>
40       </tr>
41      </table>
42     </td>
43    </tr>
44   </table>
45  
46 
47 </body>
48 </html>