快速将DIV居中

   //绝对定位
 position: absolute;
 left: 50%;
 top: 50%;
    /*因为绝对定位以左上角为轴,离左边50%,上面50%盒子会挤掉部分空间
    transform将容器再分50%*/
 transform: translate(-50%,-50%);

你可能感兴趣的:(快速将DIV居中)