日期:2014-05-16  浏览次数:20627 次

HTML5元素-表格元素

HTML5元素-表格元素

<!-- 生成基本的表格 -->
<table>
	<tr>
		<th></th>
		<th></th>
	</tr>
	<tr>
		<th></th>
		<tr></tr>
	</tr>
</table>

<!-- 为表格添加 表头,表体,表脚 -->
<table>
	<thead> 
		<tr>
			<th>  </th><th>  </th>
		</tr>
	</thead>
	<tbody>
		<tr>
			<th>  </th>
			<tr>  </tr>
		</tr>
	</tbody>
	<tfoot>
		<tr>
			<th>  </th>
			<tr>  </tr>
		</tr>
	</tfoot>
</table>

<!-- 制作不规则表格 -->
<!-- 行列合并属性: 行合并 rowspan 列合并 colspan -->

<!-- 把表头与单元格关联起来 -->
<!-- 使用 headers 属性 -->
<table>
	<thead> 
		<tr>
			<th id = "first col">  </th>
			<th id = "seccond col">  </th>
		</tr>
	</thead>
	<tbody>
		<tr>
			<th id = "first row" headers = "first col">  </th>
			<tr headers = "seccond col first row">  </tr>
		</tr>
	</tbody>
	<tfoot>
		<tr>
			<th id = "second row" headers = "first col">  </th>
			<th headers = "seccond col second row" >  </th>
		</tr>
	</tfoot>
</table>

<!-- 为表格添加标题 -->
<table>
	<caption>标题</caption>
</table>

<!-- 处理列 -->
<table>
	<colgroup id = "colgroup1" span = "3"/>
	<colgroup id = "colgroup2" span = "2"/>
</table>

<!-- 处理个别列 -->
<table>
	<colgroup id = "colgroup1">
		<col id = "col1and2" span = "2"/>
		<col id = "col3"/>
	</colgroup>
</table>

<!-- 设置表格边框 -->
<!-- 使用属性 border 其值必须设置为1或空字符串"" -->

?