The CSS position property is used to set position for an element. it is also used to place an element behind another and also useful for scripted animation effect. You can position an element using the top, bottom, left and right properties.
|static||Default value. Elements render in order, as they appear in the document flow. The top, right, bottom, left and z-index properties do not apply.|
|relative||The element is positioned relative to its normal position, so left:20px adds 20 pixels to the element's LEFT position|
|fixed||The element is positioned relative to the browser window|
|absolute||The element is positioned relative to its first positioned (not static) ancestor element|
|initial||Sets this property to its default value.|
|inherit||Inherits this property from its parent element.|
|sticky||Experimental feature. It behaves like position: static within its parent until a given offset threshold is reached, then it acts as position: fixed.|
|unset||Combination of initial and inherit.|
When absolute positioning is used the box of the desired element is taken out of the Normal Flow and it no longer affects the position of the other elements on the page. Offset properties:1. top 2. left 3. right 4. bottom specify the element should appear in relation to its next non-static containing element.
Defining position as fixed we can remove an element from the document flow and set its position relatively to the browser window. One obvious use is when we want something to be visible when we scroll to the bottom of a long page.
Relative positioning moves the element in relation to where it would have been in normal flow .Offset properties:1. top 2. left 3. right 4. bottom are used to indicate how far to move the element from where it would have been in normal flow
The default position of an element is static.This keyword lets the element use the normal behavior, that is it is laid out in its current position in the flow. The top, right, bottom, left and z-index properties do not apply.