margin-collapse-101

Margin Collapsing: in flow

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: in flow</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/001.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 { border-spacing: 0; font-size: 50px; border: solid; }
10    td { background: orange; padding: 0; }
11    div { margin: 1em 0; }
12    .a { background: yellow; }
13    .b { background: lime; }
14    .c { background: aqua; }
15    .d { background: blue; }
16    .red { background: red; }
17   </style>
18  </head>
19  <body>
20   <p>The pattern below should be a stack of horizontal bars with no red.</p>
21   <table>
22    <tr>
23     <td class="test">
24      <div class="d">
25       <div class="red"><div class="red"><div class="a">A</div></div><div class="red"></div></div>
26       <div class="red"></div>
27       <div class="red"><div class="red"></div></div>
28       <div class="red"><div class="b"><div class="red"></div>B</div></div>
29       <div class="c">C</div>
30      </div>
31     </td>
32     <td class="control">
33      <div class="d">
34       <div class="a">A</div>
35       <div class="b">B</div>
36       <div class="c">C</div>
37      </div>
38     </td>
39    </tr>
40   </table>
41   <p>This test is meaningless if you don't pass <a href="margin-collapse-106">margin-collapse-106</a>.</p>
42  
43 
44 </body>
45 </html>