Attributo HTML colspan


Definizione e utilizzo

L' colspanattributo definisce il numero di colonne su cui una cella di tabella deve occupare.


Si applica a

L' colspanattributo può essere utilizzato sui seguenti elementi:

Elementi Attributo
<td> colspan
<i> colspan

Esempi

Td Esempio

Una tabella HTML con una cella di tabella che si estende su due colonne:

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

L'esempio

Una tabella HTML con una cella di intestazione che si estende su due colonne:

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

Supporto browser

L' colspanattributo ha il seguente supporto del browser per ogni elemento:

Element
td Yes Yes Yes Yes Yes
th Yes Yes Yes Yes Yes