clear-float-003

Clear floats handled after margin collapsing

WeasyPrint

This browser

Assertion
Clearance is introduced as spacing above the top margin after margin collapsing occurs.

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: Clear floats handled after margin collapsing</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="">
 8         <meta name="assert" content="Clearance is introduced as spacing above the top margin after margin collapsing occurs.">
 9         <style type="text/css">
10             #div1
11             {
12                 height: 2in;
13                 width: 2in;
14             }
15             #div2
16             {
17                 background: red;
18             }
19             #div3
20             {
21                 margin-top: 1in;
22                 margin-bottom: 1in;
23             }
24             #div4
25             {
26                 background: green;
27                 clear: right;
28                 margin-top: -1in;
29             }
30             #div2, #div4
31             {
32                 float: right;
33                 height: 1in;
34                 width: 1in;
35             }
36         </style>
37     </head>
38     <body>
39         <p>Test passes if there is no red visible on the page.</p>
40         <div id="div1">
41             <div id="div2"></div>
42             <div id="div3"></div>
43             <div id="div4"></div>
44         </div>
45     </body>
46 </html>