Style position Property
Style position Property
The position property is used to either set or return the type of positioning method used for an element. Some methods are:-
- fixed
- static
- relative
- absolute
- sticky
Syntax:-
Its syntax is:- object.style.position OR object.style.position = static | absolute | fixed | relative | sticky | initial | inherit
Return:-
Its return is:- a string containing the position type of an element
Further Explanation:-
Value | Description |
---|---|
static | Elements render in order as they appear in the document flow. |
absolute | The element is positioned relative to its first positioned ancestor element. |
fixed | The element is positioned relative to the browser window. |
relative | The element is positioned relative to its normal position. |
sticky | The element is positioned based on the user scroll position. |
initial | Sets property to its default value. |
inherit | Inherits property from its parent element. |