I have spotted a strange behaviour of an inline or inline-block element with vertical-align: middle inside another inline/inline-block.
html
<button id="button-1">
<span><span class="one">Some text</span></span>
</button>
<button id="button-2">
<span><span class="two">Some text</span></span>
</button>
css
button {
padding: 12px 16px;
background: blue;
color: white;
border-radius: 3px;
border: 0;
}
span {
line-height: 24px;
}
.one {
vertical-align: baseline;
}
.two {
vertical-align: middle;
}
button-1 has 48px height while button-2 has 49.05px.
You may want vertical-align: middle in case of buttons with multiple elements like icon + text. That's pretty strange that button's inner height becomes more then 24px line-height.
Of course it can be fixed with making button inline-flex and not using vertical-align but still confusing.
The main question: is there a way to do not use flexbox leave vertical-align: middle and preserve needed height of the button?
There is a sandbox to play with https://codesandbox.io/s/sad-glitter-uxjx39?file=/styles.css