css垂直居中

比如弹框[代码仅有弹框部分,透明背景省略,为防止继承背景需用rgba做透明度,如rgba(0,0,0,0.3)]

.tankuang{
    width: 50%;
    height: 50%;
    margin:auto;
    overflow: auto;
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
}

 欢迎指正

原文地址:https://www.cnblogs.com/wangduojing/p/6246417.html