Search within TutorialsPark

CSS position Property


To specify the positioning scheme to be used layout the element.


Definition and Notes.

1. The CSS position property enables you to define what type of positioning method is used by a browser when the element is laid out on the webpage.

2. Any element can be positioned, but an element positioned with absolute or fixed values will generate a block level box regardless of what type of element it is.

Syntax:

CSS position property. internetexplorer safari firefox opera chrome

View in Splitscreen»

Code-Editor:

Note-The fixed element never moves w.r.t to the browser's viewport and occupies no space within the parent element

Property Values

Value Description
absolute The element is positioned relative to its first ancestor that has a position value other than static.
fixed Similar to absolute, but the element is positioned w.r.t to the browser's viewport
relative The element is positioned relative to its normal position within the document flow, the position of other elements remains unaffected
static The element is left in its normal position.Its the default
inherit The value of positioning property is inherited from the parent element

Specifications

Specs Value
Name position
Value static | relative | absolute | fixed | inherit
Initial Value static
Applies to All Elements
Javascript syntax object.style.position="relative"
Inherited No
Computed Value Same as declared value.
Browser Support internetexplorer safari firefox opera chrome

Related Examples.