freecoding.school100% FREE · NO SIGNUP
Grid CanyonISSUE #3 of 27

position · static · relative · absolute · fixed · sticky

FlexboVSThe Float Phantom
Flexbo saysposition controls placement: static, relative, absolute, fixed, or sticky.

static is default flow. relative nudges from the normal spot (and anchors absolute children). absolute removes from flow, positioned against the nearest positioned ancestor. fixed pins to the viewport; sticky scrolls then sticks at a threshold.

Power-ups you unlock

The Float Phantom attacks — common mistakes

Boss battleMake a sticky header (top:0) and an absolutely-positioned badge inside a relative card.

Example code

<!doctype html><html><head><meta charset="utf-8">
<style>.card{position:relative;background:#140a28;color:#e6e0ff;padding:20px;height:120px}.badge{position:absolute;top:8px;right:8px;background:#b388ff;color:#06040d;padding:2px 8px;border-radius:999px}</style></head><body style="background:#06040d;padding:20px"><div class="card"><span class="badge">new</span>card</div></body></html>
▶ Open the interactive comic issue
‹ Display · None · Contents · Table-*Z-Index · Stacking Contexts ›