Add the base class table to any <table> for clean spacing and lines.
Table styles
| Class | Effect |
|---|---|
table-striped |
zebra rows |
table-hover |
highlight row on hover |
table-bordered |
borders on all cells |
table-borderless |
no borders |
table-sm |
compact rows |
table-dark |
dark table |
align-middle |
vertically centre cells |
Coloured rows and cells
table-success, table-danger, table-warning, table-primary on a <tr> or <td>.
Head styles
<thead class="table-dark"> or table-light.
Responsive tables
Wrap the table in <div class="table-responsive"> so it scrolls sideways on small screens instead of breaking the layout.
Example
Example — Striped, hover and responsive table
HTML
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
<div class="container my-3">
<div class="table-responsive">
<table class="table table-striped table-hover align-middle">
<thead class="table-dark">
<tr><th>#</th><th>Student</th><th>Course</th><th>Marks</th><th>Result</th></tr>
</thead>
<tbody>
<tr><td>1</td><td>Asha</td><td>BCA</td><td>88</td><td><span class="badge text-bg-success">Pass</span></td></tr>
<tr><td>2</td><td>Ravi</td><td>BSc IT</td><td>64</td><td><span class="badge text-bg-success">Pass</span></td></tr>
<tr class="table-danger"><td>3</td><td>Aman</td><td>BCA</td><td>27</td><td><span class="badge text-bg-danger">Fail</span></td></tr>
</tbody>
</table>
</div>
</div>