本文介紹HTML colgroup span 屬性的使用方法,在線實例演示如何使用HTML colgroup span 屬性、瀏覽器的兼容性、語法定義及它的屬性值詳細資料等。
使用<colgroup> span屬性設(shè)置前兩列的背景色:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>HTML <colgroup> span 屬性使用-菜鳥教程(cainiaoplus.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> 元素應(yīng)該橫跨的列數(shù)。
提示:要為 <colgroup> 內(nèi)的列定義不同的屬性,請在 <colgroup> 標簽內(nèi)使用 <col> 標簽。
無。
<colgroup span="number">
| 值 | 描述 |
|---|---|
| number | 設(shè)置列組應(yīng)該橫跨的列數(shù)。 |