CSS position屬性研究
定義
用來指定element的定位方式
-
static(default)
normal flow,top,bottom,left and right properties no effect.
-
relative:
moving it relative to its position in normal flow
-
fixed
it fixes an element relative to the browser viewport.
-
absolute
moves an element completely out of the page’s normal layout flow ,like it is setting on its own separte layer. it is positioned relative to the nearest positioned ancestor(instead of position relative to the viewport,like fixed)
note:A positioned element is one whose position is anything except static.
-
sticky
makes an element act like static until it hits a defined offset from the viewport,at which point it acts like position:fixed.
reference
All articles in this blog are licensed under CC BY-NC-SA 4.0 unless stating additionally.
Comment