I wrote CSS with vertical-align
applied to one of these boxes.
Then, vertical-align
, which is specified for only one side, is applied to the other element.
.a {
height: 75px;
width: 75px;
background-color: red;
}
.a,
.b {
display: inline-block;
}
.a {
vertical-align: middle; /* vertical-align applied to .a also affects .b */
}
<div class="a"></div>
<div class="b">
<p>texttttt</p>
</div>
Why does setting the vertical-align
on one side affect the other side?