Attribut HTML <th> rowspan

❮ Balise HTML <th>

Exemple

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

<table>
  <tr>
    <th>Month</th>
    <th>Savings</th>
    <th rowspan="3">Savings for holiday!</th>
  </tr>
  <tr>
    <td>January</td>
    <td>$100</td>
  </tr>
  <tr>
    <td>February</td>
    <td>$80</td>
  </tr>
</table>

Plus d'exemples "Essayez-le vous-même" ci-dessous.


Définition et utilisation

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


Prise en charge du navigateur

Attribute
rowspan Yes Yes Yes Yes Yes


Syntaxe

<th rowspan="number">

Valeurs d'attribut

Value Description
number Sets the number of rows a header cell should span. Note: rowspan="0" tells the browser to span the cell to the last row of the table section (thead, tbody, or tfoot)

Plus d'exemples

Exemple

Utilisation de rowspan="0" (fonctionne dans Chrome, Firefox et Opera) :

<table>
<thead>
  <tr>
    <th>Month</th>
    <th>Savings</th>
    <th rowspan="3">Savings for holiday!</th>
  </tr>
</thead>
<tbody>
  <tr>
    <td>January</td>
    <td>$100</td>
    <td rowspan="0">$100</td>
  </tr>
  <tr>
    <td>February</td>
    <td>$80</td>
  </tr>
</tbody>
</table>

❮ Balise HTML <th>