Responsive Tables
Play nice on various screen sizes!
Full Table Responsive
The first way to make a table responsive, is to wrap it with <div class="table-responsive"></div>
. This way the table will be horizontally scrollable and all the data will be accessible on smaller screens (< 768px). Try resizing your browser window to check it live!
Client | Subscription | Actions | ||
---|---|---|---|---|
client1 | [email protected] | Trial | ||
client2 | [email protected] | VIP | ||
client3 | [email protected] | Business | ||
client4 | [email protected] | VIP | ||
client5 | [email protected] | Personal | ||
client6 | [email protected] | Business | ||
client7 | [email protected] | Personal |
Partial Table Responsive
The second way is to use specific CSS classes for hiding columns in various screen resolutions. This way you can hide the less important columns and keep the most valuable on mobiles. At the following example the Subscription column isn't visible on small and extra small screens and Email column isn't visible on extra small screens. Try resizing your browser window to check it live!
Below you can find all the available classes you can use to make your tables responsive. These classes also work with most HTML elements, so you can make them visible only on the screens you want, too.
Extra small devices Phones (<768px) |
Small devices Tablets (≥768px) |
Medium devices Desktops (≥992px) |
Large devices Desktops (≥1200px) |
|
---|---|---|---|---|
.visible-xs |
||||
.visible-sm |
||||
.visible-md |
||||
.visible-lg |
||||
.hidden-xs |
||||
.hidden-sm |
||||
.hidden-md |
||||
.hidden-lg |