Bootstrap is a popular front-end development framework that provides a set of pre-built components to quickly create responsive and mobile-first websites. Bootstrap tables Styling are one of the most common components used in web development. Here are some ways to style Bootstrap tables:
- Basic table styling:
Bootstrap provides basic styling for tables out of the box. To apply basic styling to a table, add the table
class to the <table>
element. For example:
<table class="table">
<thead>
<tr>
<th>#</th>
<th>First Name</th>
<th>Last Name</th>
<th>Username</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>Mark</td>
<td>Otto</td>
<td>@mdo</td>
</tr>
<tr>
<td>2</td>
<td>Jacob</td>
<td>Thornton</td>
<td>@fat</td>
</tr>
<tr>
<td>3</td>
<td>Larry</td>
<td>the Bird</td>
<td>@twitter</td>
</tr>
</tbody>
</table>
- Striped table:
To add striped rows to a table, add the table-striped
class to the <table>
element. For example:
<table class="table table-striped">
...
</table>
- Hoverable rows: To add hoverable rows to a table, add the
table-hover
class to the <table>
element. For example:
<table class="table table-hover">
...
</table>
- Bordered table:
To add borders to a table, add the table-bordered
class to the <table>
element. For example:
<table class="table table-bordered">
...
</table>
- Responsive table:
To make a table responsive, add the table-responsive
class to the parent <div>
element. For example:
<div class="table-responsive">
<table class="table">
...
</table>
</div>
These are just some of the basic ways to style Bootstrap tables. You can also customize the table styling by adding your own CSS rules or using pre-built table styles from Bootstrap themes.