Attribut HTML <td> colspan

❮ Balise HTML <td>

Exemple

Un tableau HTML avec une cellule de tableau qui s'étend sur deux colonnes :

<table>
  <tr>
    <th>Month</th>
    <th>Savings</th>
  </tr>
  <tr>
    <td>January</td>
    <td>$100</td>
  </tr>
  <tr>
    <td>February</td>
    <td>$80</td>
  </tr>
  <tr>
    <td colspan="2">Sum: $180</td>
  </tr>
</table>

Définition et utilisation

L' colspanattribut définit le nombre de colonnes qu'une cellule 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

<td colspan="number">

Valeurs d'attribut

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

❮ Balise HTML <td>