先來(lái)看一下表格的基本結(jié)構(gòu):
<table >
<thead>
<tr>
<th>學(xué)號(hào)</th>
<th>姓名</th>
</tr>
</thead>
<tbody>
<tr>
<td>1297263791</td>
<td>張三</td>
</tr>
<tr>
<td>1297263792</td>
<td>趙四</td>
</tr>
</tbody>
</table>

表格默認(rèn)樣式.png
一、常用標(biāo)簽
1、table標(biāo)簽包含整個(gè)表格
2、thead標(biāo)簽包含表格頭部
3、表格的每一排內(nèi)容使用tr標(biāo)簽
4、表格頭部的每個(gè)單元格使用th標(biāo)簽
5、tbody包含表格的主體
6、表格主體的每個(gè)單元格使用td標(biāo)簽
二、常用類
1.table標(biāo)簽
1)加table類(為表格加基本樣式)

加table類后的表格.png
2)加table table-striped類(在基本表格基礎(chǔ)上給表格加條紋)

加table table-striped類后的條紋表格.png
3)加table table-bordered類(在基本表格基礎(chǔ)上給表格加邊框)

加table table-bordered類后的邊框表格.png
4)加table table-condensed類(在基本表格基礎(chǔ)上縮小表格內(nèi)邊距)

加table table-condensed類后的壓縮表格.png
以上的類還可以根據(jù)樣式需要,搭配使用。
例如:加table table-striped table-bordered table-condensed 類

加table table-striped table-bordered table-condensed 類后的表格.png