Table
Table is a structure that contains a set of rows and columns, used to store or show data.

Bootstrap Table Elements
Some of the table elements supported by bootstrap are given below.
- <table>
This is used for wrapping elements for displaying data in a tabular format.
- <thead>
This tag is a container element for table header rows to label table columns.
- <tbody>
Container element for table rows in the body of the table.
- <tr>
Container element for a set of table cells that appear on a single row.
- <td>
Default table cell.
- <th>
Special table cell for column or row depending on scope and placement labels. It must be used within a <thead>.
- <caption>
Description of what the table holds.
Now, let's move ahead and take a look at different types of tables that can be used in bootstrap.
Bootstrap Basic Table
In bootstrap, basic tables can be defined by using .table class. This table has only horizontal dividers.
Example
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <title>Bootstrap Example</title>
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
- <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
- <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
- </head>
- <body>
- <div class="container">
- <h2>Basic Table in Bootstrap</h2>
- <p>The .table class adds basic styling.</p>
- <table class="table">
- <thead>
- <tr>
- <th>Firstname</th>
- <th>Lastname</th>
- <th>Email</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td>Ankur</td>
- <td>Soni</td>
- <td>[email protected]</td>
- </tr>
- <tr>
- <td>Prashant</td>
- <td>Sharma</td>
- <td>[email protected]</td>
- </tr>
- <tr>
- <td>Kartik</td>
- <td>Kumar</td>
- <td>[email protected]</td>
- </tr>
- </tbody>
- </table>
- </div>
- </body>
- </html>
Output

Table with Striped Row
In bootstrap, we can use .table-striped class to add stripes to all rows in a particular table. Let us see with a basic example of striped row.
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <title>Bootstrap Example</title>
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
- <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
- <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
- </head>
- <body>
- <div class="container">
- <h2>Striped Rows</h2>
- <p>The .table-striped class adds zebra-stripes to all rows in a table:</p>
- <table class="table table-striped">
- <thead>
- <tr>
- <th>Firstname</th>
- <th>Lastname</th>
- <th>Email</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td>Ankur</td>
- <td>soni</td>
- <td>[email protected]</td>
- </tr>
- <tr>
- <td>parshant</td>
- <td>Sharma</td>
- <td>[email protected]</td>
- </tr>
- <tr>
- <td>Kartik</td>
- <td>Kumar</td>
- <td>[email protected]</td>
- </tr>
- </tbody>
- </table>
- </div>
- </body>
- </html>

Bordered Table
In bootstrap, we can use .table-bordered class which will give borders to all sides of the table. Below is the example of a bordered table.
In bootstrap, we can use .table-bordered class which will give borders to all sides of the table. Below is the example of a bordered table.
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <title>Bootstrap Example</title>
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
- <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
- <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
- </head>
- <body>
- <div class="container">
- <h2>Bordered Table</h2>
- <table class="table table-bordered">
- <thead>
- <tr>
- <th>Firstname</th>
- <th>Lastname</th>
- <th>Email</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td>Dilip</td>
- <td>vats</td>
- <td>[email protected]</td>
- </tr>
- <tr>
- <td>Dinesh</td>
- <td>Bhati</td>
- <td>[email protected]</td>
- </tr>
- <tr>
- <td>Amit</td>
- <td>Kumar</td>
- <td>[email protected]</td>
- </tr>
- </tbody>
- </table>
- </div>
- </body>
- </html>






Anu VPosted Feb 7, 2017, 11:17 PM
Thanks for sharing.. Nice article..
Abhishek ChandelPosted Jan 26, 2017, 10:24 AM
Nice share, will help a lot of newbies like me.
Joe WilsonPosted Jan 20, 2017, 4:08 AM
Well, thank you very much for sharing.
Vishal PrajapatiPosted Jan 18, 2017, 12:51 AM
Very nice article..keep up the good work..
Vinodh NarayananPosted Jan 18, 2017, 12:00 AM
Good one keep going friend
Manav PandyaPosted Jan 17, 2017, 11:59 PM
Thanks for sharing , thats what im looking for