效果展示:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Stict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang = "zh-CN">
<head>
<meta http-equiv="Content-Type" content="text/html charset=utf-8">
<title>colspan測試用例</title>
</head>
<body>
<div align="center">
<table border="1">
<tr>
<th>Month</th>
<th>Savings</th>
<th>Account</th>
</tr>
<tr>
<td colspan="3">January</td>
</tr>
<tr>
<td colspan="3">February</td>
</tr>
</table>
</div>
</body>
</html>
運行方法:代碼直接粘貼到一個html文件中,即可執行,顯示出效果。
**注:**1、第12行到第16行有幾對<th><\th>
標籤,第19行與第23行的colspan就必須賦值成相應的數字,這樣每一行的兩邊纔可以對齊。