Loading lessons...
Tables
Tables
Bootstrap 5 styles <table> elements automatically when you add the .table class.
Basic table
<table class="table">
<thead>
<tr>
<th>Firstname</th>
<th>Lastname</th>
<th>Email</th>
</tr>
</thead>
<tbody>
<tr>
<td>John</td>
<td>Doe</td>
<td>john@example.com</td>
</tr>
<tr>
<td>Mary</td>
<td>Moe</td>
<td>mary@example.com</td>
</tr>
</tbody>
</table>
Table variants
| Class | Purpose |
|---|---|
.table-striped | Zebra stripes on rows |
.table-bordered | Borders on all cells |
.table-hover | Hover effect on rows |
.table-dark | Dark table |
.table-sm | Smaller, compact table |
Example with modifiers
<table class="table table-striped table-hover">
<tbody>
<tr>
<td>John</td>
<td>Doe</td>
</tr>
</tbody>
</table>
Contextual row colors
You can color individual rows and cells with .table-{color}:
.table-primaryblue.table-successgreen.table-dangerred.table-warningyellow.table-infolight blue.table-activegray
TL;DR
- Add
.tableto style a table. .table-stripedadds zebra stripes..table-borderedadds full borders..table-hoverhighlights rows on hover..table-darkmakes a dark table.