CSS position Property


The CSS position property specifies where an element should be placed in a document. This property, along with the left, right, top, bottom, and z-index properties, determines an element's final position on a page.

Syntax

Example

Preview

Property Values

Value Description
static The default value. Elements are rendered in the order in which they appear in the document flow.
absolute The element is positioned in relation to its first (static) ancestor element.
fixed The element is placed in relation to the browser window.
relative left:20px adds 20 pixels to the element's LEFT position because it is positioned relative to its normal position.
sticky The element's position is determined by the user's scroll position. Depending on the scroll position, a sticky element switches between relative and fixed mode. It is positioned relative until a given offset position in the viewport is met, at which point it "sticks" in place (like position: fixed).
initial Note: IE/Edge 15 and earlier are not supported. With a -webkit- prefix, Safari has supported it since version 6.1. " Returns the value of this property to its default value.
inherit This property is inherited from its parent element.

Supported Browsers

Property Chrome Firefox Safari Edge / IE Opera
position 1.0 1.0 1.0 7.0 4.0