Here is some HTML code. Removing the "border: 1px solid" property from the yellow box causes it to shrink significantly.
But why does this happen?
UPDATE: Changing the p
tag to display as inline-block keeps the size consistent. It appears that the p
tag is the issue... but why would a border in the outer div cause such a drastic change in size for an inline element?
<body style="height:100%">
<div style="background-color: red; border-style:solid;">
<div style="background-color: yellow; border:1px solid;">
<p>Inside</p>
</div>
<p>Something</p>
</div>
<div style="background-color: blue; border-style:solid;">
<p>Something else </p>
</div>
</body>
To see a live demonstration, visit: http://jsfiddle.net/C2D49/