Previous Message
Next Message

IE Clear Bug

Sent by Adam Kuehn on 13 October 2004 22:10


Jeff Chastain wrote:

>.box1 { float: left; width: 200px; }
>.box2 ( margin-left: 200px; }
>.box3 ( float: left; width: 100px; }
>.box4 { margin-left: 100px; }
>.box5 { clear: both; }
>
>The problem happens when I insert a clearing element after box 3&4.  In
>FireFox, the clear just clears box 3&4, allowing me to place content in box 2
>and everything is good.  In IE, the clear element clears the entire page -
>i.e. box 1 as well.

In this case, IE is correct, and Mozilla has the bug.  Strictly 
according to the spec, and element set to clear should clear *all* 
prior elements in the source, regardless of context.  Accordingly, 
even though box 5 is a child of box 2, it is supposed to clear box 1. 
You could try to set the position of box 2 to "relative".  This 
starts a new positioning context, and may work to keep the internal 
clearing element from clearing things outside that context.  As I 
recall, that *doesn't* work, but it's worth a try.

The other thing you can do is position box 1 rather than floating it. 
If you set top: 0, left: 0, position: relative, then the clearing 
element won't see box 1 as an obstacle.  If this is all directly 
inside the body element, this will be all you need to do.  If it is 
all inside some other element, remember that top: and left: refer to 
the current positioning context.  If odd things are happening, make 
sure the parent element of box 1 is set to a position other than 
static.

HTH,
-- 

-Adam Kuehn
______________________________________________________________________
css-discuss [EMAIL-REMOVED]]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/
Previous Message
Next Message

Message thread:

Possibly related: