Attributo di intervallo di righe HTML <th>

❮ Tag HTML <th>

Esempio

Una tabella HTML con una cella di intestazione che si estende su tre righe:

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

Altri esempi "Provalo da solo" di seguito.


Definizione e utilizzo

L' rowspanattributo definisce il numero di righe su cui una cella di intestazione deve occupare.


Supporto browser

Attribute
rowspan Yes Yes Yes Yes Yes


Sintassi

<th rowspan="number">

Valori di attributo

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)

Altri esempi

Esempio

Utilizzando rowspan="0" (funziona in Chrome, Firefox e 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>

❮ Tag HTML <th>