The extra height is the height of the difference between vertical-align: baseline and vertical-align: bottom . "Line of descent." Where the seemingly random "5 extra pixels" come from. If the font size is 10 times larger, this gap will also be 10 times larger.
Furthermore, it seems that when overflow: hidden does not exist, the inline-block element has a baseline as the same baseline of its last line of text.
This makes me think that overflow: hidden causes the baseline of the entire inline-block element to be at the bottom of the element. Although there is no text there, the inline-block parent element reserves space for the descender line. In the example given in the question, it is not easy to see, since the parent inline-block element has height: 100% . So instead, the extra space reserved for the descender line overflows from this parent div.
Why is this space still there, although there is no text? I think that since inline-block creates the formatting context that calls this space. If this element were block , it would create this formatting context only after it encounters an inline element or text.
This is just a theory, but it seems to explain it. This also explains why @Jonny Synthetic answer works: adding overflow: hidden to the parent hides an extra descender line.
Thanks to @Hashem Qolami for the jsbins who gave me this theory.
uber5001 Sep 13 2018-11-14T00: 00Z
source share