Show me the code
将代碼複制儲存為
.html
結尾的檔案并用浏覽器産看結果。
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>表格</title>
</head>
<body>
<h1>HTML表格</h1>
<h2>利用table内含tr内含td标簽建立一個三行三列的表格</h2>
<table align="center">
<caption>這是caption标簽添加的表名</caption>
<thead>
<tr>
<td>外包thead标簽的表頭1</td>
<td>外包thead标簽的表頭2</td>
<td>外包thead标簽的表頭2</td>
</tr>
</thead>
<tbody>
<tr>
<td>内容11</td>
<td>内容12</td>
<td>内容13</td>
</tr>
<tr>
<td>内容21</td>
<td>内容22</td>
<td>内容23</td>
</tr>
</tbody>
</table>
<h2>利用boder= “1”屬性設定邊框,cellspacing= "1"屬性調整邊框距離,cellpadding= "1"屬性調整内容距離</h2>
<table align="center" cellspacing="1" cellspadding= "1" >
<caption>這是caption标簽添加的表名</caption>
<thead>
<tr>
<td>外包thead标簽的表頭1</td>
<td>外包thead标簽的表頭2</td>
<td>外包thead标簽的表頭2</td>
</tr>
</thead>
<tbody>
<tr>
<td>内容11</td>
<td>内容12</td>
<td>内容13</td>
</tr>
<tr>
<td>内容21</td>
<td>内容22</td>
<td>内容23</td>
</tr>
</tbody>
</table>
<h2>利用rowspan屬性合并行</h2>
<table align="center" cellspacing="1" cellspadding= "1" >
<caption>這是caption标簽添加的表名</caption>
<thead>
<tr>
<td>外包thead标簽的表頭1</td>
<td>外包thead标簽的表頭2</td>
<td>外包thead标簽的表頭2</td>
</tr>
</thead>
<tbody>
<tr>
<td rowspan="2">rowspan合并後内容</td>
<td>内容12</td>
<td>内容13</td>
</tr>
<tr>
<td>内容22</td>
<td>内容23</td>
</tr>
</tbody>
</table>
<h2>利用colspan屬性合并列</h2>
<table align="center" cellspacing="1" cellspadding= "1" >
<caption>這是caption标簽添加的表名</caption>
<thead>
<tr>
<td>外包thead标簽的表頭1</td>
<td>外包thead标簽的表頭2</td>
<td>外包thead标簽的表頭2</td>
</tr>
</thead>
<tbody>
<tr>
<td>内容11</td>
<td>内容12</td>
<td>内容13</td>
</tr>
<tr>
<td>内容21</td>
<td colspan="2">colspan合并内容</td>
</tr>
</tbody>
</table>
</body>
</html>