Fixing the double float margin bug

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 */
}

Kommentare

Einen Kommentar schreiben

Was ist die Summe aus 1 und 3?