I have two spans in a div positioned next to each other. But it gets misaligned the moment I add overflow: hidden
to one of the span
.
Why does this happen?
.parent {
border: 1px solid red;
}
.one {
height: 30px;
width: 30px;
background-color: #4784ff;
display: inline-block;
}
.two {
height: 30px;
width: calc(100% - 30px);
background-color: #08dd0f;
display: inline-block;
overflow: hidden;
}
<div class="parent">
<span class="one">One</span><span class="two">Two</span>
</div>