本文介绍HTML colgroup span 属性的使用方法,在线实例演示如何使用HTML colgroup span 属性、浏览器的兼容性、语法定义及它的属性值详细资料等。
使用<colgroup> span属性设置前两列的背景色:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>HTML <colgroup> span 属性使用-菜鸟教程(cainiaojc.com)</title>
<style>table, th, td { border: 1px solid black;}</style>
</head>
<body>
<table>
<colgroup span="2" style="background:red"></colgroup>
<tr>
<th>ISBN</th>
<th>Title</th>
<th>Price</th>
</tr>
<tr>
<td>3476896</td>
<td>My first HTML</td>
<td>$53</td>
</tr>
<tr>
<td>5869207</td>
<td>My first CSS</td>
<td>$49</td>
</tr>
</table>
</body>
</html>
测试看看 ‹/›IEFirefoxOperaChromeSafari
所有主流浏览器都支持 span 属性。
span 属性定义了 <colgroup> 元素应该横跨的列数。
提示:要为 <colgroup> 内的列定义不同的属性,请在 <colgroup> 标签内使用 <col> 标签。
无。
<colgroup span="number">
值 | 描述 |
---|---|
number | 设置列组应该横跨的列数。 |