Fancy a shot at explaining this one?

Junior Member

joined:Sept 18, 2002
posts:161
votes: 0

I don't get this.... a div (div1)defined as float:left, which is supposed to remove it from the page flow, yet the top:margin applied to div2 affects div1's margin as well, IE6 doesn't even remove div1 from any page flow, so I'm at a loss to expalin this one at all.

Junior Member

joined:Sept 18, 2002
posts:161
votes: 0

From W3C - Precise rules that govern the behavior of floats:

1. The left outer edge of a left-floating box may not be to the left of the left edge of its containing block. An analogous rule holds for right-floating elements. 2. If the current box is left-floating, and there are any left floating boxes generated by elements earlier in the source document, then for each such earlier box, either the left outer edge of the current box must be to the right of the right outer edge of the earlier box, or its top must be lower than the bottom of the earlier box. Analogous rules hold for right-floating boxes. 3. The right outer edge of a left-floating box may not be to the right of the left outer edge of any right-floating box that is to the right of it. Analogous rules hold for right-floating elements. 4. A floating box's outer top may not be higher than the top of its containing block. 5. The outer top of a floating box may not be higher than the outer top of any block or floated box generated by an element earlier in the source document. 6. The outer top of an element's floating box may not be higher than the top of any line-box containing a box generated by an element earlier in the source document. 7. A left-floating box that has another left-floating box to its left may not have its right outer edge to the right of its containing block's right edge. (Loosely: a left float may not stick out at the right edge, unless it is already as far to the left as possible.) An analogous rule holds for right-floating elements. 8. A floating box must be placed as high as possible. 9. A left-floating box must be put as far to the left as possible, a right-floating box as far to the right as possible. A higher position is preferred over one that is further to the left/right.

My senario would appear to be in direct violation of points 5,6 & 8 as div1 is the first element in the source.