Performance: Bordered and borderless tables
MEDIUM IMPACT
This concept affects page rendering speed and visual stability by controlling how table borders are drawn and how many paint operations the browser must perform.
<table class="table table-borderless"> <thead> <tr><th>Header 1</th><th>Header 2</th></tr> </thead> <tbody> <tr><td>Data 1</td><td>Data 2</td></tr> <tr><td>Data 3</td><td>Data 4</td></tr> </tbody> </table>
<table class="table table-bordered"> <thead> <tr><th>Header 1</th><th>Header 2</th></tr> </thead> <tbody> <tr><td>Data 1</td><td>Data 2</td></tr> <tr><td>Data 3</td><td>Data 4</td></tr> </tbody> </table>
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Bordered table | Standard DOM nodes | 1 per layout change | High due to many borders | [X] Bad |
| Borderless table | Standard DOM nodes | 1 per layout change | Low, no border painting | [OK] Good |