margin-collapse-132

Margin Collapsing: float positioning

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: float positioning</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/032.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: lime; }
12 
13    .test .container { display: block; margin: 1em 0 0 0; width: 8em; background: red; }
14    .test .float { float: left; margin: 0; height: 1em; width: 8em; background: yellow; }
15    .test .block { display: block; margin: 2em 0 0 0; height: 1em; background: red; }
16 
17    .control .lime { border-top: 2em solid lime; width: 8em; }
18    .control .yellow { border-top: 1em solid yellow; }
19 
20   </style>
21  </head>
22  <body>
23   <p>The following two rectangles 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="block"> </div>
30      </div>
31     </td>
32     <td class="control">
33      <div class="lime"> </div>
34      <div class="yellow"> </div>
35     </td>
36    </tr>
37   </table>
38  
39 
40 </body>
41 </html>