Why does long text inside a inline-block shift alignment of the block before?
This is my code:
ul.card { display: block }
li.card {
display: inline-block;
width: calc(12em - 12px);
height: calc(12em - 12px);
margin: 0px;
padding: 6px;
background-color: maroon; color: white
}
<ul class="card">
<li class="card test"><a href="#">Short text</a></li>
<li class="card test">Longer text shifts alignment</li>
</ul>
And this is the way it shows up:
which becomes ok with short text:
Codepen here
Why is that? how can I fix this?