Performance: Small and compact tables
This affects page load speed and rendering performance by reducing DOM size and paint area for tables.
<table class="table table-sm"> <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"> <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 |
|---|---|---|---|---|
| Default Bootstrap table | Minimal | 1 per table render | High due to large padding | [X] Bad |
| Bootstrap table with .table-sm | Minimal | 1 per table render | Lower due to reduced padding | [OK] Good |
table-sm do when added to a table?table-smtable-sm class in Bootstrap reduces the padding inside table cells, making the table smaller and more compact.table-sm does not control.table-sm = smaller, compact table [OK]table-sm with color or border classestable-sm to make tables small and compact, not table-small, small-table, or compact.table and table-sm classes inside the class attribute.table-sm with table class [OK]table-sm with table class [OK]<table class='table table-sm'> <tr><td>Item</td><td>Price</td></tr> <tr><td>Apple</td><td>$1</td></tr> </table>
table-sm on table cellstable-sm class reduces the padding inside each cell, making the table appear smaller and more compact.table-sm but by other classes like table-striped or custom CSS.table-sm = less padding, compact table [OK]table-sm changes text style or colors<table class='table small'> <tr><td>Name</td><td>Age</td></tr> <tr><td>John</td><td>30</td></tr> </table>
small is not a valid Bootstrap class for tables. The correct class to make tables compact is table-sm.tbody is optional, and td is valid for data cells. These are not errors causing lack of compactness.table-sm, not small -> Option Btable-sm for compact tables [OK]table-sm, not 'small' [OK]tbody breaks compact styletd and th rolestable class plus modifiers like table-sm for small tables, table-striped for striped rows, and table-hover for hover effect.table table-sm table-striped table-hover includes all correct classes with proper prefixes. The other options miss the base table class or use invalid class names.table with all needed modifiers [OK]table class with modifiers [OK]table classPass the test and this pattern moves unknown