Home > Article > Web Front-end > What table classes are there in bootstrap?
Bootstrap’s table classes include: 1. “.table”, basic table; 2. “.table-striped”, zebra striped table; 3. “.table-bordered”, table with borders; 4. ".table-hover", mouse-over highlighted tables, etc.
The operating environment of this tutorial: Windows7 system, bootsrap3.3.7 version, DELL G3 computer
Bootstrap provides a clear layout for creating tables. The following table lists some table elements supported by Bootstrap:
Tag | Description | |||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
The container element ( | ||||
Container element ( | ||||
Container element ( | or | ) for a group of table cells that appear on a single row. | ||
---|---|---|---|---|
Default table cell. | ||||
Special table cell used to identify a column or row (depending on range and position). Must be used within . | ||||
A description or summary of the table storage content. |
Bootstrap provides different class names for different styles of tables, mainly including:
Description | |||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Add basic styles (only horizontal separators) to any |
Add zebra stripes in | |
Add borders to all table cells | |
Enable mouse on any row within | |
Compact table | |
Responsive Formula table | |
Bordered table |
Description | |
---|---|
For a specific row or Cells apply the hover color | |
to indicate a successful or positive action | |
Indicates a warning that requires attention | |
Indicates a dangerous or potentially negative action | |
or | . |
<table class="table"> <caption>上下文表格布局</caption> <thead> <tr> <th>产品</th> <th>付款日期</th> <th>状态</th></tr> </thead> <tbody> <tr class="active"> <td>产品1</td> <td>23/11/2013</td> <td>待发货</td></tr> <tr class="success"> <td>产品2</td> <td>10/11/2013</td> <td>发货中</td></tr> <tr class="warning"> <td>产品3</td> <td>20/10/2013</td> <td>待确认</td></tr> <tr class="danger"> <td>产品4</td> <td>20/10/2013</td> <td>已退货</td></tr> </tbody></table>
By wrapping any
.tablewithin a .table-responsive class, you can make the table scroll horizontally to fit on small devices (less than 768px). You won't see any difference when viewing on large devices larger than 768px wide.
Example<div class="table-responsive"> <table class="table"> <caption>响应式表格布局</caption> <thead> <tr> <th>产品</th> <th>付款日期</th> <th>状态</th></tr> </thead> <tbody> <tr> <td>产品1</td> <td>23/11/2013</td> <td>待发货</td></tr> <tr> <td>产品2</td> <td>10/11/2013</td> <td>发货中</td></tr> <tr> <td>产品3</td> <td>20/10/2013</td> <td>待确认</td></tr> <tr> <td>产品4</td> <td>20/10/2013</td> <td>已退货</td></tr> </tbody> </table></div>
The results are as follows:
##[Related recommendations: "bootstrap tutorial
》】The above is the detailed content of What table classes are there in bootstrap?. For more information, please follow other related articles on the PHP Chinese website!