agyanadda@gmail.com

Bootstrap Tables

Content and Utilities 1 min read Updated Dec 1, 2026 Topic 12 of 32

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>

Test Yourself With Exercises

Exercise 1 Multiple Choice

Which class adds zebra stripes to table rows?

Exercise 2 Fill in the Blank

Wrap a table in a div with class table-___ to make it scroll on phones.

Exercise 3 True / False

Bootstrap table classes work without the base class table.

Frequently Asked Questions

Bootstrap only styles tables. Add sorting and search with JavaScript or a plugin like DataTables, which supports Bootstrap 5 styling.