Take a look at the example below:
.item {
padding: 16px;
height: 50px;
}
.first {
background-color: red;
display: inline-flex;
}
.second {
background-color: green;
display: inline-flex;
align-items: center;
}
<div>
<div class="item first">1</div>
<div class="item second">2</div>
</div>
I'd like to understand why setting align-items: center
on the second box made the first one pushed downwards.
Disclaimer: I know how to fix this problem, I just wanted to get an explanation, like for a dummy, why does it behave like that because I struggle to understand this behaviour.