1.定位
。position-設置定位方式
。top,right,bottom,left,z-index-設置位置
2.top/right/bottom/left
元素邊緣距離參照物邊緣的距離
3.z-index
設置元素在z軸上的排序
4.z-index 棧
5.position
。position:static | relative | absolute | fixed
6.position:relative
。仍在文檔流中
。參照物為元素本身
最常用:改變該元素層級
使用場景:絕對定位元素的參照物
7.position:absolute
。默認寬度為內容寬度
。脫離文檔流
。參照物為第一個定位祖先/根元素(根元素即html元素
8.輪播頭圖
position:relative;
position:absolute;
image.png
9.position:fixed
。默認寬度為內容寬度
。脫離文檔流
。參照物為視窗
布局:固定頂欄position:fixed; top:0
布局:遮罩position:fixed; z-index:999;top:0; width:100%,height:100%//蓋住整個頁面
布局:三行自適應布局
.head{position:absolute; top:0; left:0; width:100%; height:100%;}
.body{position:absolute; top:100px; left:0; bottom:100px; right:0;}
.foot{position:absolute; bottom:0; left:0; width:100%; height:100px;}```