floats-007

Floated elements shifting down below non-floated elements

WeasyPrint

This browser

Assertion
Left floated boxes shift down until next to another float and there is room to fit.

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: Floated elements shifting down below non-floated elements</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#floats">
 7         <meta name="flags" content="">
 8         <meta name="assert" content="Left floated boxes shift down until next to another float and there is room to fit.">
 9         <style type="text/css">
10             #div1
11             {
12                 background: purple;
13                 height: 1in;
14                 width: 1.25in;
15             }
16             #div2
17             {
18                 background: yellow;
19                 height: 0.25in;
20                 width: 0.75in;
21             }
22             #div3
23             {
24                 background: orange;
25                 float: left;
26                 height: 1in;
27                 width: 1in;
28             }
29             #div4
30             {
31                 background: blue;
32                 float: left;
33                 height: 1.25in;
34                 width: 1.25in;
35             }
36         </style>
37     </head>
38     <body>
39         <p>Test passes if the top edges of the orange and blue boxes aligned and both boxes are below all other boxes.</p>
40         <div>
41            <div id="div1"></div>
42            <div id="div2"></div>
43            <div id="div3"></div>
44            <div id="div4"></div>
45         </div>
46     </body>
47 </html>