position:static | relative | absolute | fixed | sticky
默認(rèn)值:static
適用于:除display屬性定義為table-column-group | table-column
之外的所有元素
繼承性:無
動(dòng)畫性:否
計(jì)算值:指定值
媒體:視覺
body
元素。盒子的偏移位置不影響常規(guī)流中的任何元素,其margin
不與其他任何margin
折疊。absolute
一致,但偏移定位是以窗口為參考。當(dāng)出現(xiàn)滾動(dòng)條時(shí),對(duì)象不會(huì)隨著滾動(dòng)。relative
和fixed
的合體,當(dāng)在屏幕中時(shí)按常規(guī)流排版,當(dāng)卷動(dòng)到屏幕外時(shí)則表現(xiàn)如fixed
。該屬性的表現(xiàn)是現(xiàn)實(shí)中你見到的吸附效果。(CSS3)Values | IE | Firefox | Chrome | Safari | Opera | iOS Safari | Android Browser | Android Chrome |
---|---|---|---|---|---|---|---|---|
Basic Support | 8.0+#1 | 40.0+ | 40.0+ | 8.0+ | 40.0+ | 8.0+ | 4.4+ | 28.0+ |
fixed | ||||||||
sticky | 15.0 | 40.0-58.0 #2 | 55.0 | 8.0-11.0-webkit- | 41.0 | 8.0-11.3-webkit- | 55.0 | 55.0 |
16.0+ | 56.0-64.0 #3 | 42.0-50.0 #3 | 56.0-62.0 #3 | 56.0-64.0 #3 |
table
相關(guān)的元素上,詳細(xì);thead
和tr
元素上,詳細(xì);