position CSS property specifies how an element is positioned.
The following table summarizes the usages context and the version history of this property.
|Applies to:||All elements|
|Animatable:||No. See animatable properties.|
|Version:||CSS 2, 3|
Tip: Elements with a
position other than
static are said to be positioned. Their vertical placement in the stacking context is determined by the
The syntax of the property is given with:
The example below shows the
position property in action.
ExampleTry this code »
Note: In the case of print media type, the box is rendered on every page, and is fixed with respect to the page box, even if the page is seen through a viewport (in the case of a 'print-preview' — for example).
The following table describes the values of this property.
||The element's box is a normal box, laid out according to the normal flow. The
||The element is positioned relative to its normal position (this is called the position in normal flow).|
||The element is positioned relative to its first ancestor element whose position value is other than static.|
||The element is fixed with respect to the screen's viewport and doesn't move when scrolled. When printing, the element is printed on every page.|
||The element is positioned similarly to a relatively positioned box and it "sticks" to its nearest ancestor that has a "scrolling mechanism".|
||Sets this property to its default value.|
||If specified, the associated element takes the computed value of its parent element
position property is supported in all major modern browsers.