HTML <col> span属性
例
ここでは、最初の2列の背景色が赤色です:
<table border="1">
<colgroup>
<col span="2" style="background-color:red" />
<col style="background-color:yellow" />
</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>
</table>
<colgroup>
<col span="2" style="background-color:red" />
<col style="background-color:yellow" />
</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>
</table>
試してみる »
ブラウザサポート
![]()
![]()
![]()
![]()
![]()
すべての主要ブラウザは span 属性をサポートしています。
定義と使い方
span 属性は、col 要素がまたがるべき列数を指定します。
HTML 4.01 と HTML5 の違い
NONE.
構文
<col span="number">
属性値
| 值 | 説明 |
|---|---|
| number | col 要素がまたがる列数を設定します。 |
HTML <col> タグ その他の拡張