<分区>
看看下面的例子,我的目标是让中间项始终居中——直接居中在容器 div 中。然后让左右元素与容器的最左边和最右边对齐。
下面是我为容器设计的样式,但是它仍然在元素之间放置均匀的空间,因此中间元素不会停留在确切的中间。与右侧和中间元素相比,我想要的是在左侧和中间元素之间留出更多空间 - 但中间元素再次始终居中
我如何实现这一目标?
display: flex;
justify-content: center;
align-items: center;
.left {
margin-right: auto;
justify-self: center;
align-self: center;
}
.right {
margin-left: auto;
justify-self: center;
align-self: center;
}