Understood: for vertical-align: middle middle is not the middle of the parent block, but the middle of the lowercase letter x . But due to the fact that most often the height x less than the height of capital letters, its middle is slightly below the middle of the block. At the same time, the middle of the block is taken for alignment from the child block (the one with the middle ), and the position of this middle is adjusted to the middle of the lowercase letter x parent block, as a result of which everything moves out.
All accurate slides depend on the current font and its size: if you put a font in which the height of all letters will be the same, the middle can work as expected (though then other problems will appear, but this is a different story).
Formal definition of the standard :
middle of the box with the bottom line.
display: tabledivdisplay: table, ai-display: table-cell, it works as it should. - Maxim Stepanovfont-size:0;(previouslyfooandbazwrapped in tags and already all the child elements set the font size). This solution allows you to remove annoying indentation betweeninlineblocks, which is all the greater than thefont-sizeof elements. At first glance it seems that you take away themiddleand get the same result, but no, change theline-heightand immediately see the spread of heights. I am a weak theoretician, so I won’t even build conjectures. - DaemonHK