block-non-replaced-height-008

Height determination for block-level non-replaced elements in normal flow when 'overflow' does not compute to 'visible' and elements' margins collapse

WeasyPrint

This browser

Assertion
The 'height' is the distance between the top border edge of the top most block-level child box that doesn't have margins collapsed, and the bottom border edge of the bottommost block-level child that doesn't have margins collapsed. When a block-level non-replaced element is in normal flow, 'overflow' does not compute to 'visible' but has been propagated to the viewport and the 'height' is 'auto'.

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: Height determination for block-level non-replaced elements in normal flow when 'overflow' does not compute to 'visible' and elements' margins collapse</title>
 5         <link rel="author" title="Microsoft" href="http://www.microsoft.com/">
 6         <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#normal-block">
 7         <meta name="flags" content="">
 8         <meta name="assert" content="The 'height' is the distance between the top border edge of the top most block-level child box that doesn't have margins collapsed, and the bottom border edge of the bottommost block-level child that doesn't have margins collapsed. When a block-level non-replaced element is in normal flow, 'overflow' does not compute to 'visible' but has been propagated to the viewport and the 'height' is 'auto'.">
 9         <style type="text/css">
10             html, body
11             {
12                 overflow: scroll;
13             }
14             #div1
15             {
16                 position: relative;
17             }
18             #div2, #div3, #div4
19             {
20                 width: 1in;
21             }
22             #div2, #div3
23             {
24                 background: blue;
25                 height: 0.5in;
26             }
27             #div2
28             {
29                 border-top: 0.5in solid blue;
30                 margin-top: 0.5in;
31             }
32             #div3
33             {
34                 border-bottom: 0.5in solid blue;
35                 margin-bottom: 0.5in;
36             }
37             #div4
38             {
39                 background: blue;
40                 height: 2in;
41                 left: 1in;
42                 position: absolute;
43                 top: 0;
44             }
45         </style>
46     </head>
47     <body>
48         <p>Test passes if there is a blue square below.</p>
49         <div id="div1">
50             <div id="div2"></div>
51             <div id="div3"></div>
52             <div id="div4"></div>
53         </div>
54     </body>
55 </html>