Performance: After pseudo-element
LOW IMPACT
This affects the rendering performance by adding extra elements to the DOM visually without increasing DOM nodes, impacting paint and composite stages.
div::after { content: ''; display: block; width: 100%; height: 10px; background: red; position: relative; margin-top: 10px; }
div::after { content: ''; display: block; width: 100%; height: 10px; background: red; position: absolute; top: 100%; left: 0; }
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Using :after with absolute positioning | 0 (no new DOM nodes) | 1+ if layout changes | medium due to paint and composite | [!] OK |
| Using :after with relative positioning and margin | 0 | 0 | low paint cost | [OK] Good |