Due to the widespread use of tables across third-party widgets like calendars and date pickers, we've designed our tables to be opt-in.
Just add the base class .table
to any <table>
, then extend with custom styles or our various included modifier classes.
First Name | Last Name | Username | |
---|---|---|---|
Mark | Otto | @mdo |
|
Jacob | Thornton | @fat |
|
Add .table-sm
to make tables more compact by cutting cell padding in half.
First Name | Last Name | Username |
---|---|---|
Mark | Otto | @mdo |
<table class="table table-sm">
<thead>
<tr>
<th>First Name</th>
<th>Last Name</th>
<th>Username</th>
</tr>
</thead>
<tbody>
<tr>
<td>Mark</td>
<td>Otto</td>
<td>@mdo</td>
</tr>
</tbody>
</table>
Use contextual classes to color table rows or individual cells.
Column Head | Column Head | Column Head |
---|---|---|
Column content | Column content | Column content |
Column content | Column content | Column content |
Column content | Column content | Column content |
Column content | Column content | Column content |
Use .table-striped
to add zebra-striping to any table row within the <tbody>
.
# | First Name | Last Name | Username |
---|---|---|---|
1 | Mark | Otto | @mdo |
2 | Jacob | Thornton | @fat |
<table class="table table-striped">
<thead>
<tr>
<th>#</th>
<th>First Name</th>
<th>Last Name</th>
<th>Username</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>
Use .table-select
.
# | 01 | 02 | 03 | 04 | 05 |
---|---|---|---|---|---|
1 | |||||
2 | |||||
3 |
<table class="table table-striped table-select text-xs-center">
<thead>
<tr>
<th class="empty">#</th>
<th class="text-xs-center">01</th>
<th class="text-xs-center">02</th>
<th class="text-xs-center active">03</th>
<th class="text-xs-center">04</th>
<th class="text-xs-center">05</th>
</tr>
</thead>
<tbody>
<tr>
<th>1</th>
<td><span class="icon icon-checked icon-2x"></span></td>
<td><span class="icon icon-checked icon-2x"></span></td>
<td class="active"><span class="icon icon-checked icon-2x"></span></td>
<td><span class="icon icon-checked icon-2x"></span></td>
<td><span class="icon icon-checked icon-2x"></span></td>
</tr>
<tr>
<th>2</th>
<td><span class="icon icon-checked icon-2x"></span></td>
<td><span class="icon icon-checked icon-2x"></span></td>
<td class="active"><span class="icon icon-checked icon-2x"></span></td>
<td><span class="icon icon-checked icon-2x"></span></td>
<td><span class="icon icon-checked icon-2x"></span></td>
</tr>
<tr>
<th>3</th>
<td><span class="icon icon-checked icon-2x"></span></td>
<td><span class="icon icon-checked icon-2x"></span></td>
<td class="active"><span class="icon icon-checked icon-2x"></span></td>
<td><span class="icon icon-checked icon-2x"></span></td>
<td><span class="icon icon-checked icon-2x"></span></td>
</tr>
</tbody>
</table>
Add .table-full
.
# | First Name | Last Name | Username |
---|---|---|---|
1 | Mark | Otto | @mdo |
2 | Jacob | Thornton | @fat |
Add .table-hover
to enable a hover state on table rows within a <tbody>
.
# | First Name | Last Name | Username |
---|---|---|---|
1 | Mark | Otto | @mdo |
2 | Jacob | Thornton | @fat |
<table class="table table-hover">
<thead>
<tr>
<th>#</th>
<th>First Name</th>
<th>Last Name</th>
<th>Username</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>
Add the class .selectable-rows
to any <table>
, and then configure the data-link
table row attribute of <tbody>
, like to the <input type="radio">
id selector.
Tamanho | CPU | RAM | Cache |
---|---|---|---|
1 core | 1 GB | ||
2 core | 2 GB | ||
3 core | 3 GB | ||
4 core | 4 GB |
Add .table-bordered
for borders on all sides of the table and cells.
First Name | Last Name | Username |
---|---|---|
Mark | Otto | @mdo |
Larry the Bird |
<table class="table table-bordered">
<thead>
<tr>
<th>First Name</th>
<th>Last Name</th>
<th>Username</th>
</tr>
</thead>
<tbody>
<tr>
<td>Mark</td>
<td>Otto</td>
<td>@mdo</td>
</tr>
<tr>
<td colspan="2">Larry the Bird</td>
<td>@twitter</td>
</tr>
</tbody>
</table>
Wrapping any .table
in .table-responsive
to make them scroll horizontally on small devices (under 768px). Responsive tables make use of overflow-y: hidden
, which clips off any content that goes beyond the bottom or top edges of the table. In particular, this can clip off dropdown menus and other third-party widgets.
# | Table heading | Table heading | Table heading | Table heading | Table heading | Table heading |
---|---|---|---|---|---|---|
1 | Table cell | Table cell | Table cell | Table cell | Table cell | Table cell |
2 | Table cell | Table cell | Table cell | Table cell | Table cell | Table cell |