HTMLスパン属性
定義と使用法
このspan
属性は、a
<col>
または<colgroup>
要素がまたがる列の数を定義します。
に適用されます
このspan
属性は、次の要素で使用できます。
要素 | 属性 |
---|---|
<col> | スパン |
<colgroup> | スパン |
例
列の例
ここで、最初の2つの列の背景色は赤である必要があります。
<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>
コルグループの例
<colgroup> span属性を使用して、最初の2列の背景色を設定します。
<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>
ブラウザのサポート
このspan
属性では、要素ごとに次のブラウザがサポートされています。
Element | |||||
---|---|---|---|---|---|
col | Yes | Yes | Yes | Yes | Yes |
colgroup | Yes | Yes | Yes | Yes | Yes |