.main{
height:500px;
background: #555;
// 如下代码
display: flex;
justify-content: center;
align-items: center;
}
.item{
width:100px;
height:100px;
background: #ff5;
text-align: center;
}
<div class="main">
<div class="item"></div>
</div>flex 实现子盒子居中
所谓坚持,就是从种子种下到开花结果需要等待的时间。