一、相对定位
参考点:自己
position:relative;
top:
bottom:
left:
right:
原先自己的位置还是被自己霸占了
二、绝对定位
参考点:已经相对定位过的父级(<body>)
position:absolute;
top:
bottom:
left:
right:
改变元素的层级关系(这个元素必须要经过定位)
z-index:1;
三、固定定位
position:fixed;
top:
left:
right:
参考点:自己
position:relative;
top:
bottom:
left:
right:
原先自己的位置还是被自己霸占了
二、绝对定位
参考点:已经相对定位过的父级(<body>)
position:absolute;
top:
bottom:
left:
right:
改变元素的层级关系(这个元素必须要经过定位)
z-index:1;
三、固定定位
position:fixed;
top:
left:
right:
bottom: