Performance: Block, inline, and inline-block
MEDIUM IMPACT
This concept affects how elements are sized and arranged, impacting layout calculations and rendering speed.
<div class="inline-block">Item 1</div> <div class="inline-block">Item 2</div>
<div class="block">Item 1</div> <div class="block">Item 2</div>
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| block | Low DOM ops | Multiple reflows on size changes | Moderate paint | [!] OK |
| inline | Low DOM ops | Few reflows, but limited control | Low paint | [OK] Good |
| inline-block | Low DOM ops | Single reflow on size changes | Low paint | [OK] Good |