【定位写法】
position: absolute;
top: 30px;
left: 20px;
/*位偏移 top bottom left right*/
3.固定定位
【定位导读】
以浏览器的可视窗口来移动
和父元素有关系
不随着滚动条而滚动
不占有原来的位置
【固定写法】
position: fixed;
top: 300px;
right: 30px;
/*位偏移 top bottom left right*/
【右侧版心写法】
position: fixed;
left: 50%;
margin-left: 450px;
/*再移动盒子的宽的一半*/
4.粘性定位
【定位导读】
以浏览器的可视窗口为参照点,父级则需要相对定位(top:0)
父亲必须保留位置,的定位后来者居上 ,的定位数值越大 ,的定位他的的定位位置继续占有
