HTML CSS JavaScript SEO Python Posts Privacy About Contact

CSS Position

The position property specifies the type of positioning method used for an element.

The CSS position property controls how an element is placed in the document. The top, right, bottom, left properties then offset it from that position.

Try It — All Position Types

Preview

Position Values Reference

ValueBehaviour
staticDefault — follows normal document flow
relativeOffset from its own normal position
absolutePositioned relative to nearest positioned ancestor
fixedPositioned relative to viewport — stays on screen when scrolling
stickyNormal flow until scroll threshold, then acts like fixed

Tip: position: absolute needs a positioned ancestor (relative, absolute, or fixed) to anchor to. If none exists, it anchors to the <body>.