margin-collapse-135

Margin Collapsing: negative margins with clear

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: negative margins with clear</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/035.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    .container { background: red; height: auto; border: 1em lime solid; }
10    div { clear: both; }
11    .a { margin-top: 1em; margin-bottom: 1em; }
12    .b { margin-top: 1em; margin-bottom: 1em; }
13    .c { margin-top: 1em; margin-bottom: 1em; }
14    .d { margin-top: 1em; margin-bottom: 1em; }
15    .e { margin-top: 1em; margin-bottom: -1em; }
16    .f { margin-top: 1em; margin-bottom: 1em; }
17   </style>
18  </head>
19  <body>
20   <p>There should be no red below.</p>
21   <div class="container">
22    <div class="a">
23     <div class="b"> </div>
24     <div class="c"> </div>
25    </div>
26    <div class="d">
27     <div class="e"> </div>
28     <div class="f"> </div>
29    </div>
30   </div>
31  
32 
33 </body>
34 </html>