HTML <colgroup> span属性

❮HTML<colgroup>タグ

<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属性は、 <colgroup>要素がまたがる列の数を定義します。

ヒント:内の列にさまざまなプロパティを定義するには、タグ内のタグ <colgroup>を使用します。<col> <colgroup>


ブラウザのサポート

Attribute
span Yes Yes Yes Yes Yes

構文

<colgroup span="number">

属性値

Value Description
number Sets the number of columns a column group should span

❮HTML<colgroup>タグ