A Third Cause of IE miscalculating "left:auto"

posted by Kravvitz at 8:46 PM on Nov. 21st, 2009

Categories: CSS, Browsers, MS Edge & IE, Bugs 0 comments

In IE5-7/Win when a left floated element immediately follows an absolutely positioned element (whose left and right properties are not set to a value other than the default of "auto") the absolutely positioned element will be shifted to the right by the total width of the left floated element. (Right floated elements don't trigger this bug in left-to-right text mode. As one would expect, in right-to-left text documents, float:right triggers the equivalent bug, but float:left doesn't.)

absolutely positioned element with left:auto
left float

One solution is to put an element with display:block between them.

absolutely positioned element with left:auto
left float

Another solution is to add another element there and move either of the existing elements into it.

absolutely positioned element with left:auto
left float

Last but not least, one could just give one or both of the left and right properties a valid value other than "auto" (or "inherit").

absolutely positioned element with right:0
left float

There aren't any comments on this blog entry yet.

Login or Register to post a comment