<table>...</table> - 定義表格
<tr> - 定義表行
<th> - 定義表頭
<td> - 定義表元(表格的具體數據)
不帶邊框的表格:
復制代碼代碼如下:
<table>
<tr><th>Food</th><th>Drink</th><th>Sweet</th>
<tr><td>A</td><td>B</td><td>C</td>
</table>
跨多行、多列的表元(Table Span)
跨多列的表元 <th colspan=#>
跨多行的表元 <th rowspan=#>
表格尺寸設置
<table border=#>
邊框尺寸設置:<table border width=# height=#>
表格尺寸設置:<table border cellspacing=#>
表元間隙設置:<table border cellpadding=#>
表元內部空白設置:表格內文字的對齊/布局
<tr align=#>
<th align=#> #=left, center, right
<td align=#>
復制代碼代碼如下:
<table border width=160>
<tr>
<th>Food</th><th>Drink</th><th>Sweet</th>
<tr>
<td align=left>A</td>
<td align=center>B</td>
<td align=right>C</td>
</table>
<tr valign=#>
<th valign=#> #=top, middle, bottom, baseline
<td valign=#>
復制代碼代碼如下:
<table border height=100>
<tr>
<th>Food</th><th>Drink</th>
<th>Sweet</th><th>Other</th>
<tr>
<td valign=top>A</td>
<td valign=middle>B</td>
<td valign=bottom>C</td>
<td valign=baseline>D</td>
</table>
表格在頁面中的對齊/布局(Floating Table)
<table align=left>
My favorites...
cookies, chocolates, and more.
<table align=right>
My favorites...
cookies, chocolates, and more.
<table vspace=# hspace=#> #=space value
My favorites...
cookies, chocolates, and more.
表格的標題
<caption align=#> ... </caption> #=left, center, right
復制代碼代碼如下:
<table border>
<caption align=center>Lunch</caption>
<tr><th>Food</th><th>Drink</th><th>Sweet</th>
<tr><td>A</td><td>B</td><td>C</td>
</table>
Lunch
<caption valign=#> ... </caption> #=top, bottom
valign=top is default.