计算机网络/计算机科学与应用/系统/运维/开发

flex 实现子盒子居中


    .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>


人生建议:不要因为嘴硬而失去重要的东西,清醒,知趣,明得失,知进退。

评论

^