clear-clearance-calculation-001

Clearance calculations - clear box non-collapsing margins with larger margings than clearance

WeasyPrint

This browser

Flags
ahem, image
Assertion
When a cleared element has more top margin than the height of the floated element the margin is collpased with previous in-flow children. The element is then placed at the point of the resulting collapsed margin.

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: Clearance calculations - clear box non-collapsing margins with larger margings than clearance</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#flow-control">
 7         <meta name="flags" content="ahem image">
 8         <meta name="assert" content="When a cleared element has more top margin than the height of the floated element the margin is collpased with previous in-flow children. The element is then placed at the point of the resulting collapsed margin.">
 9         <!-- C1 = H-M2 -->
10         <!-- C2 = Max(M1, M2) - M1 - M2 -->
11         <style type="text/css">
12             div
13             {
14                 font: 20px/1em Ahem;
15                 width: 5em;
16             }
17             #parent
18             {
19                 background: url('support/clear-clearance-calculation-001.png');
20                 min-height: 6em;
21             }
22             div div
23             {
24                 background: green;
25                 height: 1em;
26             }
27             #div1
28             {
29                 margin-bottom: 1em;
30             }
31             #div2
32             {
33                 float: left;
34                 margin: 0;
35             }
36             #div3
37             {
38                 clear: left;
39                 margin-top: 4em;
40             }
41         </style>
42     </head>
43     <body>
44         <p>Test passes if there is no red visible on the page.</p>
45         <div id="parent">
46             <div id="div1"></div>
47             <div id="div2"></div>
48             <div id="div3"></div>
49         </div>
50     </body>
51 </html>