我想让我的div2居中对齐,div3在右侧。
我尝试使用 text align: center 设定主 DIV,并将 float right 设定为 DIV3,但这会使其在考虑主 DIV 的剩余部分时居中对齐。我已经给主 DIV 设定了 display: inline-flex。
<div style="height: 40px;width:120px;background-color: yellow;align-items: center;">
<div style="height: 20px;width:20px;background-color: red;">
Hello
</div>
<div style="height: 20px;float: right;width:20px;background-color: red;">
</div>
</div>