First of all, your question is not a duplicate of Why is this inline-block element pushed downward? and the answer here (unlike that question) has nothing to do with vertical alignment. Nor will studying "Section 8 Box Model" of the CSS 2.2 spec enlighten you.
To understand what's happening here you need to understand about heights. The height of block containers and the height of line boxes, and how they interact.
Block containers, which includes among others display:block
and display:inline-block
elements have a height that's either the sum of the height of its block level box children, if it has any, or the sum of the line-heights of its stack of line boxes otherwise.
In the case of your example, the <body>
element, which is a display:block
block container has only inline-level children, regardless of whether the <a>
element is display:inline
or display:inline-block
so its height is the height of the sum of the line boxes. Furthermore, unless the viewport is very narrow, we can simplify things further by assuming that all the text in the <a>
element will fit on one line, and so the height of the <body>
element is the height of the one and only line box that it contains. We have this:

You'll note that I haven't depicted the boundaries of the <a>
element above. That's because its placement depends on whether it is display:inline
or display:inline-block
.
We now need to look at how line-heights are calculated from the content. For display:inline
elements we have this in the section 10.6.1 Inline, non-replaced elements of the spec.
The height of the content area should be based on the font, but this
specification does not specify how. A UA may, e.g., use the em-box or
the maximum ascender and descender of the font.
and
The vertical padding, border and margin of an inline, non-replaced box
start at the top and bottom of the content area, and has nothing to do
with the 'line-height'. But only the 'line-height' is used when
calculating the height of the line box.
Put those together, and what it means is that the height of the line box in this circumstance is the height of the text, and that the padding you have: padding: 14px 25px;
doesn't affect the height of the line box at all, when the <a>
element is display:inline
. If it doesn't affect the height of the line box, then it doesn't affect the height of the <body>
element either. But the background of the text and its padding still get painted. So we have this:

display:inline-block
is different. Here the 10.6.6 Complicated cases spec says:
For 'inline-block' elements, the margin box is used when calculating
the height of the line box.
So the line box contains the whole of the inline-block element, not just the content, but the padding, borders and margins as well. In this case we have

And we can see if we put them alongside one another, that the text is lower for display:inline-block
, than for display:inline
.
