Performance: Position fixed and sticky
MEDIUM IMPACT
This concept affects page rendering speed and visual stability by controlling element positioning and triggering layout recalculations.
header { position: sticky; top: 0; }header { position: fixed; top: 0; width: 100%; }| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| position: fixed | Element removed from flow, no DOM ops for siblings | 1 reflow on load, possible reflows on resize | Medium paint cost due to compositing | [!] OK |
| position: sticky | Element remains in flow until sticky activates | Reflows triggered on scroll when sticky activates | Lower paint cost, mostly compositing | [OK] Good |