CSS positioning steps outside of normal flow in different ways depending on the value used. This demo shows all five positioning models with labeled boxes so you can see exactly how each one behaves — and where it anchors.

Sticky note: The sticky row in this demo works because the scroll container has a fixed height and internal overflow scroll — the conditions sticky requires. Scroll inside that box to see it pin.

Fixed note: The fixed chip pins to the lower-right corner of the preview iframe (the iframe is the viewport in this context), which accurately demonstrates the concept.

What this covers

  • position: static — default; document flow places it
  • position: relative — keeps its flow slot, shifts with top/left
  • position: absolute — leaves flow; positions from nearest positioned ancestor
  • position: sticky — scrolls normally, then pins at a threshold inside its container
  • position: fixed — ignores scroll and pins to the viewport

Positioning models specimen

Preview