Definition and usage
The Position property specifies the positioning type of the element.
Description
This property defines the positioning mechanism used to create the element layout. Any element can be positioned, but an absolute or fixed element generates a block-level box, regardless of the type of the element itself. Relative positioning elements are offset relative to their default position in the normal flow.
| Default value: |
Static |
| Inheritance: |
No |
| Version: |
CSS2 |
| JavaScript Syntax: |
object. style.position= "Absolute" |
Possible values
| value |
Description |
| Absolute |
Creates an absolutely positioned element that is positioned relative to the first parent element other than the static anchor. The position of the element is defined by the "left", "Top", "right" and "bottom" attributes. |
| Fixed |
Generates an absolutely positioned element that is positioned relative to the browser window. The position of the element is defined by the "left", "Top", "right" and "bottom" attributes. |
| Relative |
Creates a relative positioned element, positioned relative to its normal position. Therefore, "left:20" adds 20 pixels to the left position of the element. |
| Static |
The default value. No positioning, elements appear in the normal stream (ignoring top, bottom, left, right, or z-index declarations). |
| Inherit |
Specifies that the value of the position property should be inherited from the parent element. |
CSS Position Properties