in Education by

Explain the Bootstrap basic table?

1 Answer

0 votes
by

The following table elements are used with Bootstrap,

 

  • <table> - It is used for wrapping element for displaying data in a tabular format
  • <thead> - It is used for container element for table header rows (<tr>) to label table columns.
  • <tbody> - It is used for container element for table rows (<tr>) in the body of the table.
  • <tr> - It is used for container element for a set of table cells (<td> or <th>) that appears on a single row.
  • <th> - Special table cell for column (or row) labels. It must be used within a <thread>
  • <td> - It is used for default table cell.
  • <caption> - It is used for description or summary of what the table holds.

Bootstrap Basic Table

We can create a basic Bootstrap table with basic styling that has a small cell padding and only horizontal dividers by adding Bootstrap class ".table" to the <table> element.

Example

Bootstrap Basic Table using .table class.

In this example we will create a simple table with Bootstrap class and using html table elements we will create an employee table with Fields Sr. No., Employee Name, Email, City by writing the following code.

  1. <!DOCTYPE html>  
  2. <html lang="en">  
  3.   
  4. <head>  
  5.     <meta charset="utf-8">  
  6.     <title>Bootstrap Part5</title>  
  7.     <meta name="viewport" content="width=device-width,initial-scale=1">  
  8.     <link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">  
  9. </head>  
  10.   
  11. <body>  
  12.     <div class="container">  
  13.         <h1>Bootstrap Basic Table</h1>  
  14.         <!--Bootstrap Basic Table using .table class-->  
  15.         <table class="table">  
  16.             <thead>  
  17.                 <tr>  
  18.                     <th>Sr.No.</th>  
  19.                     <th>Emolpyee Name</th>  
  20.                     <th>Email</th>  
  21.                     <th>City</th>  
  22.                 </tr>  
  23.             </thead>  
  24.             <tbody>  
  25.                 <tr>  
  26.                     <td>1</td>  
  27.                     <td>Shaili Dashora</td>  
  28.                     <td>[email protected] </td>  
  29.                     <td>Chittorgarh</td>  
  30.                 </tr>  
  31.                 <tr>  
  32.                     <td>2</td>  
  33.                     <td>Sourabh Somani</td>  
  34.                     <td>[email protected] </td>  
  35.                     <td>Banglore</td>  
  36.                 </tr>  
  37.                 <tr>  
  38.                     <td>3</td>  
  39.                     <td>Shobhna Singvi</td>  
  40.                     <td>[email protected]</td>  
  41.                     <td>Mumbai</td>  
  42.                 </tr>  
  43.             </tbody>  
  44.         </table>  
  45.     </div>  
  46.     <script src="js/jquery-2.1.4.min.js"></script>  
  47.     <script src="js/bootstrap.min.js"></script>  
  48. </body>  
  49.   
  50. </html>  

Output

Basic Table Layout,

Basic Table Layout

Related questions

0 votes
    Explain the basic structure of the Bootstrap grid....
asked Apr 4, 2021 in Education by JackTerrance
0 votes
    Explain Bootstrap buttons and its styles....
asked Apr 4, 2021 in Education by JackTerrance
0 votes
    Explain Bootstrap Grid System....
asked Apr 4, 2021 in Education by JackTerrance
0 votes
    Explain the use of Bootstrap CSS class="navnav-list"....
asked Apr 4, 2021 in Education by JackTerrance
0 votes
    How can you give a style to images in Bootstrap?...
asked Apr 4, 2021 in Education by JackTerrance
0 votes
    What are Containers in Bootstrap?...
asked Apr 4, 2021 in Education by JackTerrance
0 votes
    What are the advantages of Bootstrap?...
asked Apr 4, 2021 in Education by JackTerrance
0 votes
    How can we create a dropdown menu in Bootstrap?...
asked Apr 4, 2021 in Education by JackTerrance
0 votes
    How can you create Fixed Layout with Bootstrap?...
asked Apr 4, 2021 in Education by JackTerrance
0 votes
    How can you create a web page using Bootstrap?...
asked Apr 4, 2021 in Education by JackTerrance
0 votes
    How can you get Bootstrap?...
asked Apr 4, 2021 in Education by JackTerrance
0 votes
    Why choose Bootstrap for building websites?...
asked Apr 4, 2021 in Education by JackTerrance
0 votes
    What is Bootstrap?...
asked Apr 4, 2021 in Education by JackTerrance
0 votes
    What do you understand about Responsive websites?...
asked Apr 4, 2021 in Education by JackTerrance
0 votes
    Which of the following class in Bootstrap is used to create basic pagination? .page .pagin .paginate .pagination...
asked Mar 2, 2021 in Technology by JackTerrance
...