Bootstrap Components

Bootstrap Table

Overview

Tables are presented in most applications (web, desktop or mobile application) and they are a key element in presenting data to the end user.

Today, with the importance that the user interface has, knowing how to enhance the appearance of a table becomes as relevant as it is. In this scenario, one of the technologies that has become reference is Bootstrap. This front-end framework, among many other features, provides a number of features for styling and optimizing the display of various components, such as table.

Main table in Bootstrap

To style a table with Bootstrap, simply add the table class to the <table> tag, and some visual formatting will already be applied, as displayed on the screenshot .

Bootstrap basic table
<table class="table">
  <thead>
    <tr>
      <th>#</th>
      <th>First Name</th>
      <th>Last Name</th>
      <th>Username</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th scope="row">1</th>
      <td>Mark</td>
      <td>Otto</td>
      <td>@mdo</td>
    </tr>
    <tr>
      <th scope="row">2</th>
      <td>Jacob</td>
      <td>Thornton</td>
      <td>@fat</td>
    </tr>
    <tr>
      <th scope="row">3</th>
      <td>Larry</td>
      <td>the Bird</td>
      <td>@twitter</td>
    </tr>
  </tbody>
</table>

Inverse tables.

Among the latest tables in Bootsrap 4 is the inverse tables. Class .table-inverse can easily change the coloration of the table.

Bootstrap inverse table
<table class="table table-inverse">
  <thead>
    <tr>
      <th>#</th>
      <th>First Name</th>
      <th>Last Name</th>
      <th>Username</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th scope="row">1</th>
      <td>Mark</td>
      <td>Otto</td>
      <td>@mdo</td>
    </tr>
    <tr>
      <th scope="row">2</th>
      <td>Jacob</td>
      <td>Thornton</td>
      <td>@fat</td>
    </tr>
    <tr>
      <th scope="row">3</th>
      <td>Larry</td>
      <td>the Bird</td>
      <td>@twitter</td>
    </tr>
  </tbody>
</table>

Additional classes

There are also some classes that allow you to apply a different styles to a table, they are::

<table class="table-striped"> Toggles the color of table rows

<table class="table-bordered"> Adds border to the table;

<table class="table-hover"> Activates the highlight of a line when we hover the mouse cursor over it;

<table class="table-condensed"> Reduces the height of table rows, making it more compact.

To apply these styles, simply add the desired classes to the <table>: <table class="table table-striped table-bordered table-condensed table-hover">

Table head opportunities

Much like default and inverse tables, run one of two modifier classes to make <thead> appear dark or light gray.

Bootstrap table head options
<table class="table">
  <thead class="thead-inverse">
    <tr>
      <th>#</th>
      <th>First Name</th>
      <th>Last Name</th>
      <th>Username</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th scope="row">1</th>
      <td>Mark</td>
      <td>Otto</td>
      <td>@mdo</td>
    </tr>
    <tr>
      <th scope="row">2</th>
      <td>Jacob</td>
      <td>Thornton</td>
      <td>@fat</td>
    </tr>
    <tr>
      <th scope="row">3</th>
      <td>Larry</td>
      <td>the Bird</td>
      <td>@twitter</td>
    </tr>
  </tbody>
</table>

<table class="table">
  <thead class="thead-default">
    <tr>
      <th>#</th>
      <th>First Name</th>
      <th>Last Name</th>
      <th>Username</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th scope="row">1</th>
      <td>Mark</td>
      <td>Otto</td>
      <td>@mdo</td>
    </tr>
    <tr>
      <th scope="row">2</th>
      <td>Jacob</td>
      <td>Thornton</td>
      <td>@fat</td>
    </tr>
    <tr>
      <th scope="row">3</th>
      <td>Larry</td>
      <td>the Bird</td>
      <td>@twitter</td>
    </tr>
  </tbody>
</table>

Striped rows

Zebra-like stripes may be incorporated with the .table-striped class, an example

Bootstrap striped rows
<table class="table table-striped">
  <thead>
    <tr>
      <th>#</th>
      <th>First Name</th>
      <th>Last Name</th>
      <th>Username</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th scope="row">1</th>
      <td>Mark</td>
      <td>Otto</td>
      <td>@mdo</td>
    </tr>
    <tr>
      <th scope="row">2</th>
      <td>Jacob</td>
      <td>Thornton</td>
      <td>@fat</td>
    </tr>
    <tr>
      <th scope="row">3</th>
      <td>Larry</td>
      <td>the Bird</td>
      <td>@twitter</td>
    </tr>
  </tbody>
</table>

Hover Rows

To make a hover side effect in the rows of your table add in the .table-hover class:

Bootstrap hover rows
<table class="table table-hover">
  <thead>
    <tr>
      <th>#</th>
      <th>First Name</th>
      <th>Last Name</th>
      <th>Username</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th scope="row">1</th>
      <td>Mark</td>
      <td>Otto</td>
      <td>@mdo</td>
    </tr>
    <tr>
      <th scope="row">2</th>
      <td>Jacob</td>
      <td>Thornton</td>
      <td>@fat</td>
    </tr>
    <tr>
      <th scope="row">3</th>
      <td colspan="2">Larry the Bird</td>
      <td>@twitter</td>
    </tr>
  </tbody>
</table>

Bordered Table

You can surely bring in the borders on the every single table slide and a cell with the .table-bordered class:

Bootstrap bordered table
<table class="table table-bordered">
  <thead>
    <tr>
      <th>#</th>
      <th>First Name</th>
      <th>Last Name</th>
      <th>Username</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th scope="row">1</th>
      <td>Mark</td>
      <td>Otto</td>
      <td>@mdo</td>
    </tr>
    <tr>
      <th scope="row">2</th>
      <td>Mark</td>
      <td>Otto</td>
      <td>@TwBootstrap</td>
    </tr>
    <tr>
      <th scope="row">3</th>
      <td>Jacob</td>
      <td>Thornton</td>
      <td>@fat</td>
    </tr>
    <tr>
      <th scope="row">4</th>
      <td colspan="2">Larry the Bird</td>
      <td>@twitter</td>
    </tr>
  </tbody>
</table>

Condensed Table

If you wish to make your table more compact - you can easily cut cell padding in half with this class: .table-condensed.

Take note that, while Bootstrap 4 uses .table-sm to condense a table, Bootstrap 3 uses .table-condensed. Each cut cell padding in half.

Bootstrap condensed table
<table class="table table-sm">
  <thead>
    <tr>
      <th>#</th>
      <th>First Name</th>
      <th>Last Name</th>
      <th>Username</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th scope="row">1</th>
      <td>Mark</td>
      <td>Otto</td>
      <td>@mdo</td>
    </tr>
    <tr>
      <th scope="row">2</th>
      <td>Jacob</td>
      <td>Thornton</td>
      <td>@fat</td>
    </tr>
    <tr>
      <th scope="row">3</th>
      <td colspan="2">Larry the Bird</td>
      <td>@twitter</td>
    </tr>
  </tbody>
</table>

Contextual Classes

Use the contextual classes to color a table cells (<td>) and table rows (<tr>):

Bootstrap contextual classes
<!-- On rows -->
<tr class="table-active">...</tr>
<tr class="table-success">...</tr>
<tr class="table-warning">...</tr>
<tr class="table-danger">...</tr>
<tr class="table-info">...</tr>

<!-- On cells (`td` or `th`) -->
<tr>
  <td class="table-active">...</td>
  <td class="table-success">...</td>
  <td class="table-warning">...</td>
  <td class="table-danger">...</td>
  <td class="table-info">...</td>
</tr>

Changing the rows of a table Bootstrap 3 does not use the .table- prefix for its contextual classes. Bootstrap 3 uses .active while Bootstrap 4 uses .table-active. Other than that, both of these versions use the exact same 5 contextual keywords (active, success, info, warning, danger). Listed here you can see the information about each of the possible types:

● active: Applies the focus color to the table row or table cell

● success: Indicates a successful or positive action

● info: Indicates a neutral information change or action

● warning: Indicates a warning that you may need attention

● danger: Indicates a dangerous or potentially negative action

Responsive Tables

To create a responsive table - use the .table-responsive class. Table rolls in the horizontal way on gadgets that less than 768px. If the gadget is larger sized than 768px wide, then you will see no difference :

Bootstrap responsive tables

Bootstrap 4 allows you to add the .table-responsive class to the actual <table> element. Bootstrap 3 tables required that you add that class to a parent <div> element.

Examine a number of online video short training relating to Bootstrap tables

Connected topics:

Bootstrap tables: official documentation

Bootstrap tables  main documentation

W3schools:Bootstrap table tutorial

Bootstrap table  article

Bootstrap Tables Lecture

Bootstrap Tables Lecture

Best Free AI Website Builder

Generate AI websites with a simple prompt! Type in any language, export in zip.


AI Website Builder



Best Free Website Builder Software

Create awesome websites offline! No coding. 9900+ templates. Edit and save locally, upload wherever.


Free website builder download for Win, Mac, Linux!



Best Website Templates

HTML Business Templates

HTML Business Templates

Web Design HTML Templates

Web Design HTML Templates

HTML eCommerce Website Template

HTML eCommerce Website Template

Hotel HTML Template

Hotel HTML Template

Landing Page HTML Template

Landing Page HTML Template

Premium Design HTML Themes

Premium Design HTML Themes

HTML Resume Template

HTML Resume Template

Online Shopping HTML Template

Online Shopping HTML Template

HTML Responsive Templates

HTML Responsive Templates

Latest Posts

  1. Best Website Builder AIBest Free AI Website Builder - Create Website Design with AI
  2. Best Website Builder for Consultants, Magazines, Churches, Authors
  3. Best Website Builder for Designers, Videos, Education, Software Companies
  4. Website Builder for Beginners, Bloggers, Writers, IT Companies
  5. Best Website Builder for Restaurants, Online Stores, Real Estate, Musicians
  6. Best Website Builder for podcasts and affiliate marketing
  7. Therapists and nonprofits Website Builder
  8. Portfolio and SEO Website Builder
  9. Website Builder for Kids and Musicians
  10. Website Builder for Photographers and Artists
  11. HTML Code Generator - HTML Code Creator
  12. Web Design Program - Website Design Tool
  13. Landing Page Generator - Landing Page Builder
  14. No Coding Website Builder - Website Builder For Small Business
  15. Innovative HTML Builder Drag And Drop Free for Your Next Project
  16. Is There A Completely Free QR Code Generator
  17. Extremely Comfortable Business Website Constructor Review
  18. Bootstrap Select
  19. Bootstrap Panel
  20. Bootstrap Tabs
  21. Bootstrap Toggle
  22. Bootstrap Modal Popup
  23. Bootstrap Row
  24. Bootstrap Multiselect
  25. Bootstrap Media queries
  26. Bootstrap Login Forms
  27. Bootstrap Layout
  28. Bootstrap Jumbotron
  29. Bootstrap Button Group
  30. Bootstrap Breakpoints
  31. Bootstrap Navbar
  32. Bootstrap Tooltip
  33. Bootstrap Textarea
  34. Bootstrap Switch
  35. Bootstrap Slider
  36. Bootstrap Progress Bar
  37. Bootstrap Label
  38. Bootstrap Header
  39. Bootstrap Clearfix
  40. Bootstrap Sidebar
  41. Bootstrap Radio
  42. Bootstrap Offset
  43. Bootstrap Menu
  44. Bootstrap Columns
  45. Bootstrap Checkbox
  46. Bootstrap Accordion
  47. Bootstrap Image
  48. Bootstrap Grid
  49. Bootstrap Form
  50. Bootstrap Glyphicons
  51. Bootstrap List
  52. Bootstrap Carousel
  53. Bootstrap Icons
  54. Bootstrap Collapse
  55. Bootstrap Popover
  56. Bootstrap Input
  57. Bootstrap Modal
  58. Bootstrap Pagination
  59. Bootstrap Button
  60. Bootstrap Alert