【定位写法】
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.粘性定位
【定位导读】
以浏览器的可视窗口为参照点,
【定位写法】
position: relative;
top: 300px;
left: 30px;
/*位偏移 top bottom left right*/
2.绝对定位
【定位导读】
元素移动位置时候,固定定位) ,的定位图片和文字
加定位不需要转化,的定位继续保留 ,的定位父级则需要相对定位(top:0)
父亲必须保留位置 ,的定位的定位可以使用js来做*/就以浏览器来对齐的的定位
