子盒子在父盒子中居中的样式

.father{
position:relative;
width:600px;
height:600px;
}
.son{
width:200px;
height:200px;
position:absolute;
left:50%;
top:50%;
transform:translate(-50%,-50%)
}

猜你喜欢

转载自www.cnblogs.com/zhaodz/p/11563667.html