CSS定位和滾動條

2021-10-01 16:58:07 字數 797 閱讀 2270

position: absolute;

/*絕對定位:

1、定位屬性值:absolute

2、在頁面中不再佔位(浮起來了),就無法繼承父級的寬度(必須自己自定義寬度)

3、一旦定位後,定位的布局方位 top、bottom、left、right都能參與布局

4、絕對定位的參考係是最近的定位父級(不是父級中的哪一點,而是四邊參照四邊)

5、左右同時存在,取左;同理上下取上

6、當父級定位了,子級參照父級定位,又可以重新獲取父級寬度(也可以在計算中拿到父級高度)

*/學習q-q-u-n: 784783012 ,分享學習的方法和需要注意的小細節,不停更新最新的教程和學習技巧

(從零基礎開始到前端專案實戰教程,學習工具,全棧開發學習路線以及規劃)

position:fixed

生成絕對定位的元素,相對於瀏覽器視窗進行定位。

position: relative;

父級(最近的乙個父級)相對定位的目的

1)不影響自身布局

2)輔助自己絕對定位布局

position: static

預設值。沒有定位,元素出現在正常的流中(忽略 top, bottom, left, right 或者 z-index 宣告)。

position:inherit

規定應該從父元素繼承 position 屬性的值。

overflow

滾動條定位

首先來乙個例子 this is some text.this is some text.this is some text.this is some text.this is some text.this is some text.this is some text.this is some tex...

css滾動條屬性

overflow 屬性 檢索或 設定當物件的內容超 過其指定高度及寬度 時如何顯示內容 overflow auto 在需要時 內容會自動新增 滾動條overflow scroll 總是 顯示滾動條overflow x hidden 禁止橫向的 滾動條overflow y scroll 總是 顯示縱向...

css控制滾動條

1 overflow內容溢位時的設定 overflow x水平方向內容溢位時的設定 overflow y垂直方向內容溢位時的設定 以上三個屬性設定的值為visible 預設值 scroll hidden auto。2 scrollbar 3d light color立體滾動條亮邊的顏色 scroll...