IE6 Double Margin Bug Fix

4th of October, 2007

Thank you Jayme Blackmon for the simple IE6 Double Margin Bug Fix, and thanks to Google for listing it first.

If you have a floated element such as a div and you place margin-right or margin-left on that element, our most beloved Internet Explorer 6.0 will double that margin value, causing havoc in your html layout. To fix this simply add display:inline; to your floating element. Bah Boom!

Jeremy, a commenter on this post, also added something useful in case display:inline isn't an option.

margin-left:20px;
_margin-left:10px;

First one gets read by IE7 and FireFox. Second gets read by IE6. Awesome!

Respond Now

Comments are Gravatar enabled

Fields marked * are required.

Allowed XHTML:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Close
E-mail It