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