I have two div side by side. Both are the same size and display: inline-block . The only difference between the two is that the first has some text and the second is empty.
HTML:
<div>1</div> <div></div>
CSS
div { display: inline-block; border: 1px solid black; width: 50px; height: 50px; }
The first div is lower than the second.
I know all the possible corrections, for example, adding some text or to the second div. Adding vertical-align: top also fixes this, of course.
What I want to know, can someone explain why an empty div has a different alignment than a div with some text in it?
Jsfiddle
source share