Solution (Clean Solution) - with Side Effects
Date of the Solution
Thu Aug 13 09:27:23 2009
Fixed Versions
All of the affected
Description
This solution is as simple as the other "Clean Solution" for this bug:
Due to the nature of the bug, fixed demo is available on a separate page
- HTML Code:
<div id="container">
<div id="middle-man">
<p>I has margins!</p>
</div>
</div>
- CSS Code:
#container {
background: #f00;
border: 2px solid #000;
}
#middle-man {
background: #ddd;
padding: 5% 0;
overflow: hidden;
}
p {
margin: 100px 0;
}
All I did is add overflow property set to value hidden on the #middle-man - the element with percentage padding. Any overflow value other than visible can be used to fix the bug.
Side Effects
The side effect of this solution may be the fact that you want overflow to be visible - nothing major. Also, note, that if you're using the height trick for the IE6 min-height workaround, you could set overflow for IE8-only or use the other "Clean Solution" for this bug that involves setting a tiny border.