table
适用DTD:Strict Transitional Frameset 适用浏览器:All
释义
表格(table)
语法
<table 属性="属性值">~标签内容~</table>
<table 属性="属性值">~标签内容~</table>
说明
终止标签不能省略
属性
nbsp;
示范
表格的基本结构:
<table>
<tr>
<td>表格数据</td>
</tr>
</table>
<table>
<tr>
<td>表格数据</td>
</tr>
</table>
范例
下面的例子显示了XHTML文件基础结构:
运行
打印
下面的例子显示了XHTML文件基础结构:


<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>元素table</title>
</head>
<body>
<table border="1" bordercolor="lime" width="500" height="400">
<caption><em>a test table with merged cells</em></caption>
<tr><th>males<td>1.9<td>0.003<td>40%
<tr><th>females<td>1.7<td>0.002<td>43%
</table>
<p>最基本的HTML表格是由table、tr、td组成的,tr表示行,td表示单元格,可以只有一行一列,即只有一个单元格。<br>下图显示了cellpadding与cellspacing的关系:<br><img src="src/cell.gif" alert="cellpadding VS cellspacing"></p>
</body>
</html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>元素table</title>
</head>
<body>
<table border="1" bordercolor="lime" width="500" height="400">
<caption><em>a test table with merged cells</em></caption>
<tr><th>males<td>1.9<td>0.003<td>40%
<tr><th>females<td>1.7<td>0.002<td>43%
</table>
<p>最基本的HTML表格是由table、tr、td组成的,tr表示行,td表示单元格,可以只有一行一列,即只有一个单元格。<br>下图显示了cellpadding与cellspacing的关系:<br><img src="src/cell.gif" alert="cellpadding VS cellspacing"></p>
</body>
</html>