block-formatting-contexts-004

Block Formatting Contexts: Margin Collapsing

WeasyPrint

This browser

Flags
ahem, image
Assertion
Margins collapse between adjacent block boxes in a block formatting context.

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: Block Formatting Contexts: Margin Collapsing</title>
 5         <link rel="author" title="Microsoft" href="http://www.microsoft.com/">
 6         <link rel="help" href="http://www.w3.org/TR/CSS21/visuren.html#block-formatting">
 7         <meta name="flags" content="ahem image">
 8         <meta name="assert" content="Margins collapse between adjacent block boxes in a block formatting context.">
 9         <style type="text/css">
10             #div1
11             {
12                 background: url("support/margin-collapse-2em-space.png");
13                 font: 20px/1em Ahem;
14                 height: 4em;
15                 width: 5em;
16             }
17             #div2
18             {
19                 margin-bottom: 1em;
20             }
21             #div3
22             {
23                 margin-top: 2em;
24             }
25         </style>
26     </head>
27     <body>
28         <p>Test passes if there is no red visible on the page.</p>
29         <div id="div1">
30             <div id="div2">XXXXX</div>
31             <div id="div3">XXXXX</div>
32         </div>
33     </body>
34 </html>