flex 布局方式,写在父容器上,作用在父容器的内容上
display: flex;
justify-content: center;
align-items: center;
transform 方式
top:50%;
left:50%;
transform:translate(-50%, -50%);
position fixed 方式
div{
position:fixed;
margin:auto;
left:0;
right:0;
top:0;
bottom:0;
width:200px;
height:150px;
}
grid 布局实现上下左右居中也很方便