我在 Flexbox 中有一个包含三个元素的布局,如下所示:
.flex-container {
display: flex;
justify-content: space-between;
align-items: center;
}
<div class="flex-container">
<div class="flex-item"> computed width of 50px </div>
<div class="flex-item plz-center"> computed width of 25px </div>
<div class="flex-item"> computed width of 150px </div>
</div>
Run Code Online (Sandbox Code Playgroud)
我想将中间的项目居中plz-center,并将其他项目保留在两侧,如下图所示:
它们在弹性行中工作正常,但如果最终项目的宽度不同,则中间项目不会保持居中。我最好plz-center修复一下吗?