blocks-017

CSS Blocks: Margin Collapsing

WeasyPrint

This browser

Source

 1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
 2 <html>
 3  <head>
 4   <title>CSS Test: CSS Blocks: Margin Collapsing</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/007.xml" type="application/xhtml+xml">
 7   <link rel="help" href="http://www.w3.org/TR/CSS21/box.html#collapsing-margins">
 8   <style type="text/css">
 9    div {
10      border: solid blue;
11      height: 180px;
12    }
13    div > * { 
14      margin: 1em;
15      height: 1em;
16      border-spacing: 0;
17      display: block;
18      font: 20px/20px Ahem;
19    }
20    table, td { padding: 0; border-spacing: 0; }
21   </style>
22  </head>
23  <body>
24   <p>The black bars should not overflow the blue box.</p>
25   <div>
26    <table><tr><td>Test</td></tr></table>
27    <table><tr><td>Test</td></tr></table>
28    <p>Test</p>
29    <p>Test</p>
30   </div>
31   <p>This test has passed if the black bars are evenly distributed (vertically) in the blue box.</p>
32  </body>
33 </html>