margin-collapse-137

Margin Collapsing: margins on relative boxes

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: margins on relative boxes</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/037.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    .ahem { display: inline; font: 1em/1 Ahem, sans-serif; background: red; color: white; }
10    div { font: 1em/1 Ahem, sans-serif; }
11    .relative { position: relative; margin: 0 0 5em 0; }
12    .absolute { position: absolute; margin: 0; top: 0; left: 0; color: green; }
13    .static { position: static; margin: 0; color: red; }
14   </style>
15  </head>
16  <body>
17   <div class="relative">
18    <div class="absolute">
19     XXXXX
20    </div>
21   </div>
22   <div class="static">
23    XXXXX
24   </div>
25   <p>There should be no red above.</p>
26   <div class="ahem">Ahem_font_required_for_this_test.</div>
27  
28 
29 </body>
30 </html>