margin-collapse-139

Margin Collapsing: top margins

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: top margins</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/039.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    .a { margin: 0; background: red; }
10    .b { margin: 2em 0 0 0; background: red; }
11    .c { margin: 1em 0 0 0; background: red; }
12    .d { margin: 0; background: green; color: white; }
13   </style>
14  </head>
15  <body>
16   <p>There should be no red below.</p>
17   <div class="a">
18    <div class="b">
19     <div class="c">
20      <div class="d">
21       This line should be green.
22      </div>
23     </div>
24    </div>
25   </div>
26  
27 
28 </body>
29 </html>