Golang Tutorials - Learn Go Programming with Easy Step-by-Step Guides

Explore comprehensive Golang tutorials for beginners and advanced programmers. Learn Go programming with easy-to-follow, step-by-step guides, examples, and practical tips to master Go language quickly.

Bs5 Tables in Bootstrap

Bs5 Tables in Bootstrap

Absolutely! Here’s a handy guide to Bootstrap 5 Tables — styled tables with various features for responsive and clean data presentation.


?? Bootstrap 5 Tables

Bootstrap 5 provides easy-to-use classes to style HTML tables with borders, stripes, hover effects, and responsiveness.


1. Basic Table

<table class="table">  <thead>    <tr>      <th scope="col">#</th>      <th scope="col">First</th>      <th scope="col">Last</th>      <th scope="col">Handle</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>  </tbody></table>

2. Table Variants

ClassDescription
.table-stripedAdds zebra-striping rows
.table-borderedAdds borders on all cells
.table-hoverAdds hover effect on rows
.table-smSmaller, compact table
.table-borderlessRemoves borders

Example:

<table class="table table-striped table-hover table-bordered">  ...</table>

3. Table Dark Variant

For dark backgrounds:

<table class="table table-dark">  ...</table>

Can combine with other classes like .table-striped:

<table class="table table-dark table-striped">  ...</table>

4. Responsive Tables

Wrap your table in .table-responsive to enable horizontal scrolling on small devices:

<div class="table-responsive">  <table class="table">    ...  </table></div>

For responsive behavior at specific breakpoints, use:

  • .table-responsive-sm

  • .table-responsive-md

  • .table-responsive-lg

  • .table-responsive-xl

  • .table-responsive-xxl


5. Caption

Add a caption to describe the table:

<table class="table">  <caption>List of users</caption>  ...</table>

6. Alignment and Vertical Alignment

Use utility classes for text alignment:

  • .text-start, .text-center, .text-end

For vertical alignment in cells:

  • .align-baseline

  • .align-top

  • .align-middle

  • .align-bottom

  • .align-text-bottom

Example:

<td class="text-center align-middle">Centered middle cell</td>

Summary Table

ClassEffect
.tableBase Bootstrap table
.table-stripedZebra stripe rows
.table-borderedBorders on all cells
.table-hoverRow hover effect
.table-smSmaller compact table
.table-darkDark themed table
.table-responsiveResponsive scroll container

If you want me to help create complex tables with sorting, pagination, or integrate with JS libraries like DataTables, just say!

Disclaimer for AI-Generated Content:
The content provided in these tutorials is generated using artificial intelligence and is intended for educational purposes only.
html
docker
php
kubernetes
golang
mysql
postgresql
mariaDB
sql