I am sure that this was asked earlier in one form or another, but I just cannot find the answer.
I have several nested divs
<div class="parent"> <div class="child">A</div> </div>
And the child has a display: inline-block and overflow: hidden
.parent{ background-color:red; } .child{ background-color:green; display:inline-block; overflow:hidden; }
And it turns out like this: 
You may notice that the parent is 5px taller than the child.
Where does the extra height come from?
Here is an example: http://jsfiddle.net/w8dfU/
Edit: I donโt want to remove the display: inline-block or overflow: hidden, this is a simplified example to illustrate the problem, but in my real layout I need both of them. I just want to understand why this extra height appears. Is it somewhere indicated that this should be so? Is this a consequence of some other css function?
html css height overflow
stralsi Dec 01 '13 at 9:26 a.m. 2013-12-01 09:26
source share