absolute
The element is positioned relative to its first positioned (not static) ancestor element.
相对于第一个position
属性不是static
的祖先元素进行定位
fixed
The element is positioned relative to the browser window 相对于浏览器窗口进行定位
relative
The element is positioned relative to its normal position, so "left:20px" adds 20 pixels to the element's LEFT position 相对于本身正常的位置进行定位
relative
behaves the same as static
unless you add some extra properties.
relative
和static
表现一致,除非添加一些额外的属性
Setting the top
, right
, bottom
, and left
properties of a relatively-positioned element will cause it to be adjusted away from its normal position. Other content will not be adjusted to fit into any gap left by the element.
设置top
、right
、bottom
、left
属性将会使其偏离正常位置,其他元素不会因为这个元素位置的变动留出的空白而有所调整。
sticky
The box position is calculated according to the normal flow (this is called the position in normal flow). Then the box is offset relative to its flow root and containing block and in all cases, including table elements, does not affect the position of any following boxes. When a box B is stickily positioned, the position of the following box is calculated as though B were not offset. The effect of ‘position: sticky’ on table related elements is the same as for ‘position: relative’.
根据正常流进行偏移