margin-collapse-020

Margin collapsing with the root element

WeasyPrint

This browser

Flags
ahem, image
Assertion
For HTML pages the html element does not collapse its margins with other elements.

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 root 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 image">
 8         <meta name="assert" content="For HTML pages the html element does not collapse its margins with other elements.">
 9         <style type="text/css">
10             html
11             {
12                 background: url('support/margin-collapse-020.png') 0 -1em no-repeat;
13                 font: 20px/1em Ahem;
14                 margin-top: 1em;
15             }
16             body
17             {
18                 margin: 0;
19             }
20             div
21             {
22                 background: green;
23                 margin-top: 1em;
24                 height: 1em;
25                 width: 5em;
26             }
27             p
28             {
29                 font: 12pt serif;
30             }
31         </style>
32     </head>
33     <body>
34         <div></div>
35         <p>Test passes if there is no red visible on the page.</p>
36     </body>
37 </html>