1、flex布局
.method1{
display:flex;
justify-content:center;
align-items:center;
}
2、position布局+transform
.method2{
position:relative;
justify-content:center;
align-items:center;
img{
position:absolute;
left:50%;
top:50%;
transform:translate(-50%,-50%);
}
}
网友评论