HTML Dog
Skip to navigation

CSS Property: position

How a box’s position is calculated.

A box can be positioned with the top, right, bottom, and left properties. These will have different effects depending on the value of position.

Boxes with position: absolute applied and stacked on top of one another.

Possible Values

ValueDescription
staticFollows the normal flow in a layout. top, right, bottom, and left have no effect. Default.
relativePosition is offset from the initial position.
absoluteTaken out of the flow and positioned in relation to the containing box.
fixedTaken out of the flow and positioned in relation to the viewport. It will not scroll with the rest of the page’s content.
inherit
initial
unset

Example


#oogabooga {
    position: relative;
    left: 1em;
    top: 1em;
}

Browser support

Can I Use css-fixed? Data on support for the css-fixed feature across the major browsers from caniuse.com.