Performance: Position absolute
MEDIUM IMPACT
Position absolute affects layout stability and paint performance by removing elements from normal flow and creating new stacking contexts.
div {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}div {
position: absolute;
top: 50%;
left: 50%;
transform: translate(50%, 50%);
}| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Using many absolute elements with frequent position changes | High (many nodes) | Multiple reflows per change | High paint cost due to overlapping | [X] Bad |
| Using few absolute elements with stable positions | Low | Single reflow on initial layout | Low paint cost | [OK] Good |