The position property sets how an element is placed in the document. Pair it with inset offsets such as top, left, or inset.
static is normal flow. relative offsets from that spot but keeps the original space. absolute and fixed leave the flow. sticky sticks after a scroll threshold. Anything except static is a positioned element.
Standard-track.
Not deprecated. Baseline widely available. Sticky needs a non-auto inset and a scrolling ancestor to stick.
Make a scrollport.overflow: auto and a fixed height let the panel scroll.
Set sticky + threshold.position: sticky with top: 0 sticks when the box reaches the top edge.
Still in flow at first. Until the threshold, the box behaves like relative.
Stuck only inside the ancestor. Sticky stops at the edges of its containing block; it does not float forever like fixed.
Edge Cases & Pitfalls
If offsets or sticky fail, one of these is usually why.
static
Offsets ignore static
top, left, and friends do nothing on a static box. Change the position keyword first.
absolute
Absolute climbs to a positioned ancestor
If every parent is static, absolute uses a higher containing block. Set relative (or another non-static value) on the intended parent.
sticky
Sticky needs an inset and a scrollport
Without top/left/…, sticky acts like relative. Also check that an ancestor can scroll and is not clipped in a way that prevents sticking.
fixed
transform can trap fixed
A filtered, transformed, or perspective ancestor can become the containing block for fixed, so the box sticks to that ancestor instead of the viewport.
stack
Layering uses z-index
Positioned elements can form stacking contexts. Control overlap with z-index when boxes cover each other.
Compatibility
Browser Support
position is a browser layout property. Node.js, Deno, and Bun do not apply it.
✓ Baseline · Widely available
position
static / relative / absolute / fixed: all modern browsers and Internet Explorer. sticky: Chrome 56+, Firefox 59+, Safari 13+, Edge 16+.
97%Modern browser support
Google Chrome1+ · sticky 56+
Full support
Mozilla Firefox1+ · sticky 59+
Full support
Apple Safari1+ · sticky 13+
Full support
Microsoft Edge12+ · sticky 16+
Full support
Opera4+ · sticky 43+
Full support
Samsung Internet1+ · sticky 6+
Full support
Internet ExplorerAll but sticky
Partial
positionWidely supported
Bottom line: Safe for everyday layout. Prefer sticky only when you can accept no support in Internet Explorer, or provide a non-sticky fallback.
Remember
Key Takeaways
Role: choose how a box participates in layout and where offsets apply.
Common values:static, relative, absolute, fixed, sticky.
Initial value:static. Not inherited.
Pairing: use inset offsets; use a positioned parent for absolute children.
One line:position picks the scheme; top/left/inset pick the place.
Frequently Asked Questions
It sets how an element is placed in the document. static follows normal flow. relative offsets from its normal spot. absolute and fixed leave the flow. sticky sticks after a scroll threshold.
The initial value is static. top, right, bottom, left, and z-index do not move a static element.
relative keeps the element in flow and shifts it from its original place. absolute removes it from flow and places it against the nearest positioned ancestor (or the initial containing block).
Absolute uses the closest ancestor with position other than static as its containing block. A common pattern is position: relative on the parent so the child stays inside that box.
Sticky needs a non-auto inset such as top: 0, and a scrolling ancestor. If both insets on an axis are auto, sticky behaves like relative on that axis.
static, relative, absolute, and fixed are supported in all modern browsers and IE. sticky is Baseline and widely available (Chrome 56+, Firefox 59+, Safari 13+, Edge 16+). It is a browser layout property, not a Node.js feature.