什么是相对定位?
如果存在一个点(x,y),我们想要将其移动到点(x-2,y-2),则可以对这个点开启相对定位position:relative
然后使用属性left , top ,right , bottom对位置进行调整。
则调整后的位置为(x+left-right , y-top+bottom)
移动到(x-2,y-2),则可以让left为-2 , right为0 ,top为2 ,bottom为0 ,也可以有其他组合。
.box1{
position:relative;
left:-2;
top:2;
}