Solution (Clean Solution)
Date of the Solution
Fri Jul 17 02:33:58 2009
Fixed Versions
all of the affected
Description
Nothing special to this solution. All that we are adding is one line of code, overflow: hidden in particular. This does the trick of hiding the excessive space that IE puts in the wrong place. Here is our original demo with the fix applied to it:
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Suspendisse vel velit at ipsum tristique porttitor. Suspendisse potenti. Nam non arcu sit amet nulla volutpat bibendum. Aenean eget metus. Nulla elit. Quisque aliquam luctus diam. Curabitur at lectus. In hac habitasse platea dictumst. Nam ultrices porttitor dolor. Morbi metus. Praesent et nulla at pede elementum consectetuer. Donec sapie...
*cry*
- HTML Code:
-
<div id="container">
<div id="bugger">
Lorem ipsum dolor sit amet, consectetuer
adipiscing elit. Suspendisse vel
velit at ipsum tristique porttitor. Suspendisse
potenti. Nam non arcu sit amet nulla volutpat
bibendum. Aenean eget metus. Nulla elit.
Quisque aliquam luctus diam. Curabitur at
lectus. In hac habitasse platea dictumst.
Nam ultrices porttitor dolor. Morbi metus.
Praesent et nulla at pede elementum consectetuer.
Donec sapie...
</div>
<div id="victim">*cry*</div>
</div>
- CSS Code:
#container {
width: 500px;
overflow: hidden; /* just containing floats */
}
#bugger {
float: left;
width: 300px;
font-style: italic;
overflow: hidden; /* bug fix */
}
#victim {
width: 200px;
float: left;
height: 200px; /* just to make bug more obvious */
}
Pretty straight-forward. We are setting overflow: hidden on #bugger, the element with font-style: italic applied, and that causes the bug to be hidden.
Depending on what your situation is like, applying overflow: hidden may not be favorable. If that's your case, you will be interested in the "Conditional Comments" solution.