We use cookies to improve your experience. Learn more in our Privacy policy.
position
The position CSS property sets how an element is positioned in a document. The top, right, bottom, and left properties determine the final location of positioned elements.
Initial value | static |
Applies to | all elements |
Syntax
position: relative;
Values
The element is positioned according to the normal flow of the document. The top, right, bottom, left, and z-index properties have no effect. This is the default value.
The element is positioned according to the normal flow of the document, and then offset relative to itself based on the values of top, right, bottom, and left. The offset does not affect the position of any other elements; thus, the space given for the element in the page layout is the same as if position were static.
This value creates a new stacking context when the value of z-index is not auto. Its effect on table-*-group, table-row, table-column, table-cell, and table-caption elements is undefined.
The element is removed from the normal document flow, and no space is created for the element in the page layout. It is positioned relative to its closest positioned ancestor, if any; otherwise, it is placed relative to the initial containing block. Its final position is determined by the values of top, right, bottom, and left.
This value creates a new stacking context when the value of z-index is not auto. The margins of absolutely positioned boxes do not collapse with other margins.
Browser support
position | chrome1 | edge12 | firefox1 | ie4 | opera4 | safari1 |
absolutely_positioned_flex_children | chrome52 | edge12 | firefox52 | ie10 | opera39 | safari11 |
fixed | chrome1 | edge12 | firefox1 | ie7 | opera4 | safari1 |
position_sticky_table_elements | chrome56 | edge16 | firefox59 | ie | opera43 | safari8 |
sticky | chrome56 | edge16 | firefox32 | ie | opera43 | safari13 |