margin-collapse-011

Margin collapsing and elements with 'overflow' set to 'auto'

WeasyPrint

This browser

Flags
ahem
Assertion
Elements with 'overflow' set to 'auto' do not collapse margin with in-flow children.

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 and elements with 'overflow' set to 'auto'</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">
 8         <meta name="assert" content="Elements with 'overflow' set to 'auto' do not collapse margin with in-flow children.">
 9         <style type="text/css">
10             div
11             {
12                 font: 20px/1em Ahem;
13                 height: 5em;
14                 width: 5em;
15             }
16             #div1
17             {
18                 height: 2em;
19                 margin-top: 2em;
20                 overflow: auto;
21             }
22             #div2
23             {
24                 background: red;
25                 height: 1em;
26                 margin-top: 2em;
27             }
28         </style>
29     </head>
30     <body>
31         <p>Test passes if there is no red visible on the page.</p>
32         <div>
33             <div id="div1">
34                 <div id="div2"></div>
35             </div>
36         </div>
37     </body>
38 </html>