I am confused when calculating the height of a block element which contains an inline-block element, and the code is below:
<div style="background: orange;">
<div style="display: inline-block;"></div>
</div>
<div style="background: green;">
<div style="background: #d9d9d9; display: inline-block; font-size: 48px; line-height: 12px;">H</div>
</div>
and you can find example here.
My question is why the height of the parent element is 20px under chrome? I think it should be 0 due to its child has no height.
And in the second example, how to calculate the parent height when the child line-height is less than font-size?