子类在父类居中

//上下左右,都居中 
.box{ 100px; height: 100px; border: 1px solid blue; display: flex; } .box1{ 50px; height: 50px; border: 1px solid red; margin: auto; }

//左右居中 
.box{
             100px;
            height: 100px;
            border: 1px solid blue;
           /*display: flex;*/
        }
        .box1{
             50px;
            height: 50px;
            border: 1px solid red;
            margin: auto;
        }

原文地址:https://www.cnblogs.com/huangxingyuan/p/6392807.html