Attribut HTML <th> colspan

❮ Balise HTML <th>

Exemple

Un tableau HTML avec une cellule d'en-tête qui s'étend sur deux colonnes :

<table>
  <tr>
    <th colspan="2">Monthly Savings</th>
  </tr>
  <tr>
    <td>January</td>
    <td>$100</td>
  </tr>
  <tr>
    <td>February</td>
    <td>$80</td>
  </tr>
</table>

Définition et utilisation

L' colspanattribut définit le nombre de colonnes qu'une cellule d'en-tête doit couvrir.


Prise en charge du navigateur

Attribute
colspan Yes Yes Yes Yes Yes

Remarque : Seul Firefox prend en charge colspan="0", qui a une signification particulière (regardez ci-dessous dans le tableau "Valeurs d'attribut").


Syntaxe

<th colspan="number">

Valeurs d'attribut

Value Description
number Sets the number of columns a header cell should span. Note: colspan="0" tells the browser to span the cell to the last column of the column group (colgroup)

❮ Balise HTML <th>