Bootstrap Tables

A basic Bootstrap table has a light padding and only horizontal dividers. The .table class adds basic styling to a table.

Sample Code:

<!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="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
  <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
</head>
<body>

<div class="container">
  <h2>Basic Table</h2>          
  <table class="table">
    <thead>
      <tr>
        <th>Firstname</th>
        <th>Lastname</th>
        <th>Email</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td>Test1</td>
        <td>Test1</td>
        <td>Test1@example.com</td>
      </tr>
      <tr>
        <td>Test2</td>
        <td>Test2</td>
        <td>Test2@example.com</td>
      </tr>
      <tr>
        <td>Test3</td>
        <td>Test3</td>
        <td>Test3@example.com</td>
      </tr>
    </tbody>
  </table>
  <h2>Striped Table</h2>    
  <table class="table-striped">
    <thead>
      <tr>
        <th>Firstname</th>
        <th>Lastname</th>
        <th>Email</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td>Test1</td>
        <td>Test1</td>
        <td>Test1@example.com</td>
      </tr>
      <tr>
        <td>Test2</td>
        <td>Test2</td>
        <td>Test2@example.com</td>
      </tr>
      <tr>
        <td>Test3</td>
        <td>Test3</td>
        <td>Test3@example.com</td>
      </tr>
    </tbody>
  </table>
  <h2>Bordered Table</h2>    
  <table class="table-bordered">
    <thead>
      <tr>
        <th>Firstname</th>
        <th>Lastname</th>
        <th>Email</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td>Test1</td>
        <td>Test1</td>
        <td>Test1@example.com</td>
      </tr>
      <tr>
        <td>Test2</td>
        <td>Test2</td>
        <td>Test2@example.com</td>
      </tr>
      <tr>
        <td>Test3</td>
        <td>Test3</td>
        <td>Test3@example.com</td>
      </tr>
    </tbody>
  </table>
  <h2>Mouser Over or Hover Table</h2>    
  <table class="table-hover">
    <thead>
      <tr>
        <th>Firstname</th>
        <th>Lastname</th>
        <th>Email</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td>Test1</td>
        <td>Test1</td>
        <td>Test1@example.com</td>
      </tr>
      <tr>
        <td>Test2</td>
        <td>Test2</td>
        <td>Test2@example.com</td>
      </tr>
      <tr>
        <td>Test3</td>
        <td>Test3</td>
        <td>Test3@example.com</td>
      </tr>
    </tbody>
  </table>
  <h2>Condensed Table</h2>    
  <table class="table-condensed">
    <thead>
      <tr>
        <th>Firstname</th>
        <th>Lastname</th>
        <th>Email</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td>Test1</td>
        <td>Test1</td>
        <td>Test1@example.com</td>
      </tr>
      <tr>
        <td>Test2</td>
        <td>Test2</td>
        <td>Test2@example.com</td>
      </tr>
      <tr>
        <td>Test3</td>
        <td>Test3</td>
        <td>Test3@example.com</td>
      </tr>
    </tbody>
  </table>
</div>

</body>
</html>

Output:



Cheers!!!

No comments:

Post a Comment