Responsive Tables & Table Layout

Bootstrap Framework 8 min min read Updated: Nov 16, 2026 Intermediate
Responsive Tables & Table Layout
Intermediate Topic 2 of 7

The Problem

Tables with many columns are too wide for phone screens. They would force the entire page to scroll sideways. The fix is to wrap the table in a responsive container so only the table scrolls.

Responsive Wrapper

html <div class="table-responsive"> <table class="table"> ...many columns... </table> </div>

On small screens, the table gets a horizontal scroll bar while the rest of the page stays still.

Responsive Only Until a Breakpoint

html <div class="table-responsive-md"> <table class="table">...</table> </div>

The table scrolls below the medium breakpoint and shows normally above it. Use table-responsive-sm, -lg, -xl or -xxl for other sizes.

Practical Example: Student Table

html <div class="table-responsive"> <table class="table table-striped table-hover align-middle"> <thead class="table-dark"> <tr> <th>#</th> <th>Student</th> <th>Email</th> <th>Status</th> <th class="text-end">Actions</th> </tr> </thead> <tbody> <tr> <td>1</td> <td>Aisha Khan</td> <td>aisha@example.com</td> <td><span class="badge text-bg-success">Active</span></td> <td class="text-end"> <button class="btn btn-sm btn-outline-primary">Edit</button> <button class="btn btn-sm btn-outline-danger">Delete</button> </td> </tr> <tr> <td>2</td> <td>Rahul Verma</td> <td>rahul@example.com</td> <td><span class="badge text-bg-warning">Pending</span></td> <td class="text-end"> <button class="btn btn-sm btn-outline-primary">Edit</button> <button class="btn btn-sm btn-outline-danger">Delete</button> </td> </tr> </tbody> </table> </div>
Result

A professional data table with a dark header, status badges and small action buttons that scrolls sideways on phones.

Sticky Header

html <div class="table-responsive" style="max-height: 300px;"> <table class="table"> <thead class="sticky-top bg-white">...</thead> <tbody>...</tbody> </table> </div>

Tips for Mobile Tables

  • Show only the most important columns on phones using d-none d-md-table-cell on the others
  • Use short headings
  • Use text-nowrap to avoid breaking cell contents when scrolling is acceptable
html <th class="d-none d-md-table-cell">Email</th> <td class="d-none d-md-table-cell">aisha@example.com</td>

Conclusion

A good responsive table keeps your page layout stable on every device. Always wrap wide tables.

Quick Summary: Wrap the table in table-responsive (or -md, -lg). Hide less important columns on phones with d-none d-md-table-cell.

Get Newsletter

Subscibe to our newsletter and we will notify you about the newest updates on Edugators