Attributo HTML <colgroup> span

❮ Tag HTML <colgroup>

Esempio

Imposta il colore di sfondo delle prime due colonne utilizzando l'attributo span <colgroup>:

<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>

Definizione e utilizzo

L' spanattributo definisce il numero di colonne su cui un <colgroup>elemento dovrebbe occupare.

Suggerimento: per definire proprietà diverse per una colonna all'interno di un <colgroup>, utilizzare il <col>tag all'interno del <colgroup>tag.


Supporto browser

Attribute
span Yes Yes Yes Yes Yes

Sintassi

<colgroup span="number">

Valori di attributo

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

❮ Tag HTML <colgroup>