### table 表格標簽
使用格式
```
<table 屬性1="屬性值1" 屬性2="屬性值2" ... ... >表格內容</table>
```
#### 屬性
* width height 表示表格的寬度和高度,他的值可以是像素(px)也可以是父級元素的百分百(%)
* border 表示表格外邊框的寬度,`默認值為0`
* align 表格的顯示位置,默認值為left,可選值`left,center,right`
* cellspacing 單元格之間的間距,`默認是2px`
* cellpadding 單元格內容與單元格邊框的顯示距離
* frame 控制表格邊框最外層的四條線框,`默認值void`,無邊框
>[info] above 表示僅頂部有邊框
> bottom 表示僅底部有邊框
> hsides 表示僅有頂部邊框和底部邊框
> lhs 表示僅有左側邊框
> rhs 表示僅有右側邊框
> vsides 表示僅有左右側邊框
> box border 包含4個邊框
* rules 控制是否顯示以及如何顯示單元格之間的分割線,默認值為none,無分割線
>[info] all 包含所有分割線
> rows 僅有行分割線
> cols 僅有列分割線
> groups 在行組和列祖之間有分割線
### caption 表格標題標簽
表示表格的標題
使用格式
```
<caption>屬性的插入位置,直接位于<table>屬性之后,<tr>表格行之前
```
#### 屬性
align默認值為top,可選值`bottom,left,right`
### tr 表格行標簽
定義表格的一行,對于每一個表格行,都是由一對`<tr>...</tr>`標記表示,每一行`<tr>`標記內可以嵌套多個`<td>`或者`<th>`標記
#### 屬性
* bgcolor 設置背景顏色
* align 設置垂直方向對齊方式 `bottom,middle, top`
* valign 設置水平方向對齊方式 `center,left,right`
### th 和 td
`<th>`是表頭標記,通常位于首行或者首列,`<th>`中的文字默認會被加粗,而`<td>`不會
#### 屬性
* bgcolor 設置背景顏色
* width height 表示單元格的寬度和高度
* align 設置垂直方向對齊方式 `bottom,top,middle`
* valign 設置水平方向對齊方式 `center,left,right`
* rowspan 設置單元格所占行數
* colspan設置單元格所占列數
例子
表格嵌套時左對齊
```
<!DOCTYPE html>
<html>
<head>
<title>第8節課</title>
<meta charset="utf8">
</head>
<body topmargin='5%' leftmargin='0px' link="blue" vlink="red" alink="green">
<table width="90%" border="0px" align="center" cellspacing="0px" cellpadding="0px">
<tr bgcolor="green" height='90px' align="center">
<td>
<font size="8" color="white"><b>head</b></font>
</td>
</tr>
<tr >
<td>
<table width="30%" height='500px' bgcolor="yellow" align="left">
<tr align="center">
<td>
<font size="8" color="white"><b>left</b></font>
</td>
</tr>
</table>
<table width="70%" height='500px' bgcolor="#ccc" align="left">
<tr align="center">
<td>
<font size="8" color="white"><b>main</b></font>
</td>
</tr>
</table>
</td>
</tr>
<tr bgcolor="green" height='90px' align="center">
<td>
<font size="8" color="white"><b>bottom</b></font>
</td>
</tr>
</table>
</body>
</html>
```
顯示效果
