Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Chapter 4: Bootstrap Tables

    • 1
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 816
    Comment on it

    In Bootstrap table has a little padding and horizontal dividers. These tables are very clean and padding value is 8px with 1.4 line-height and vertical-align is top.

    To make a table within bootstrap you have to add .table class and this is called Basic table.

    1. <table class = "table">
    2. <thead>
    3. <tr>
    4. <th>City</th>
    5. <th>Pincode</th>
    6. </tr>
    7. </thead>
    8. <tbody>
    9. <tr>
    10. <td>Dhradun</td>
    11. <td>248001</td>
    12. </tr>
    13. </tbody>
    14. </table>

    With the basic table here is few more table classes in bootstrap

     

    Striped table -

    To use it you need to add a .table-striped class with .table class. This shows your table row in 2 different color means some even number of table row will white and odd number row will light gray color.

    1. <table class = "table table-striped">
    2. <thead>
    3. <tr>
    4. <th>City</th>
    5. <th>Pincode</th>
    6. </tr>
    7. </thead>
    8. <tbody>
    9. <tr>
    10. <td>Bangalore</td>
    11. <td>560001</td>
    12. </tr>
    13. <tr>
    14. <td>Mumbai</td>
    15. <td>400003</td>
    16. </tr>
    17. </tbody>
    18. </table>

     

    Bordered table -

    By adding a .table-bordered class with .table class, In your table column get a border vertically border.

    1. <table class = "table table-bordered">
    2. <thead>
    3. <tr>
    4. <th>City</th>
    5. <th>Pincode</th>
    6. </tr>
    7. </thead>
    8. <tbody>
    9. <tr>
    10. <td>Bangalore</td>
    11. <td>560001</td>
    12. </tr>
    13. <tr>
    14. <td>Mumbai</td>
    15. <td>400003</td>
    16. </tr>
    17. </tbody>
    18. </table>

     

    Hover Table -

    Using .table-hover class you will get cursor hovers pointer) on each row with gray background color on hover.

    1. <table class = "table table-hover">
    2. <thead>
    3. <tr>
    4. <th>City</th>
    5. <th>Pincode</th>
    6. </tr>
    7. </thead>
    8. <tbody>
    9. <tr>
    10. <td>Bangalore</td>
    11. <td>560001</td>
    12. </tr>
    13. <tr>
    14. <td>Mumbai</td>
    15. <td>400003</td>
    16. </tr>
    17. </tbody>
    18. </table>

     

    Responsive Table -

    If you want to make your table responsive, for it you need to wrap the table in .table-responsive named class div. This will make a horizontal scroll under 768px view port.

    1. <div class = "table-responsive">
    2. <table class = "table table-hover">
    3. <thead>
    4. <tr>
    5. <th>City</th>
    6. <th>Pincode</th>
    7. </tr>
    8. </thead>
    9. <tbody>
    10. <tr>
    11. <td>Bangalore</td>
    12. <td>560001</td>
    13. </tr>
    14. <tr>
    15. <td>Mumbai</td>
    16. <td>400003</td>
    17. </tr>
    18. </tbody>
    19. </table>
    20. </div>

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Reset Password
Fill out the form below and reset your password: