Latest web development tutorials

HTML colgroup span 屬性

HTML colgroup 標籤參考手冊 HTML <colgroup>標籤

實例

使用<colgroup> span 屬性設置前兩列的背景顏色:

<table border="1">
<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>

嘗試一下»

瀏覽器支持

Internet ExplorerFirefoxOperaGoogle ChromeSafari

所有主流瀏覽器都支持span 屬性。


定義和用法

span 屬性定義了<colgroup> 元素應該橫跨的列數。

提示:要為<colgroup>內的列定義不同的屬性,請在<colgroup>標籤內使用<col>標籤。


HTML 4.01 與HTML5之間的差異

無。


語法

<colgroup span="number">

屬性值

描述
number 设置列组应该横跨的列数。


HTML colgroup 標籤參考手冊 HTML <colgroup>標籤