Kornfeldstraße > Blog posts

Fixing the double float margin bug

2009-01-24 16:32 by Georg Hölzl

How to fix the Internet Explorer double float margin bug

The IE double float margin bug shows up in practically every floated CSS layout. If there is a floating element with a margin value, its margin will be doubled in IE6. To fix this behaviour, simply set the floated element's display property to inline. Here is a short example that uses the "Star HTML Hack":

#element {
float:left; margin:10px;
}
* html #element {
display:inline; /* IE only */
}

Go back

Add a comment