margin-collapse-021

Margin collapsing with the 'body' element

WeasyPrint

This browser

Flags
HTMLonly, ahem, image
Assertion
For HTML pages the 'body' element's margins collapse.

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: Margin collapsing with the 'body' element</title>
 5         <link rel="author" title="Microsoft" href="http://www.microsoft.com/">
 6         <link rel="help" href="http://www.w3.org/TR/CSS21/box.html#collapsing-margins">
 7         <meta name="flags" content="ahem HTMLonly image">
 8         <meta name="assert" content="For HTML pages the 'body' element's margins collapse.">
 9         <style type="text/css">
10             body
11             {
12                 background: url('support/margin-collapse-020.png') no-repeat;
13                 font: 20px/1em Ahem;
14                 margin: 2em 0 0;
15             }
16             div
17             {
18                 background: green;
19                 margin-top: 2em;
20                 height: 1em;
21                 width: 5em;
22             }
23             p
24             {
25                 font: 12pt serif;
26             }
27         </style>
28     </head>
29     <body>
30         <div></div>
31         <p>Test passes if there is no red visible on the page.</p>
32     </body>
33 </html>