今天遇到了一个大家都会但是可能会记得不清楚的问题
1.margin
.father{
width:400px;
height:400px;
background:black;
margin: 0 auto;
}
2.相对定位与位移
.father{
width:400px;
height:400px;
background:black;
position: relative;
left: 50%;
transform: translate(-50%)
}
3. 相对定位
father{
width:400px;
height:400px;
background:black;
position: relative;
left: 50%;
margin-left:-200px;
}
在记一下