Definizione e utilizzo
Il colspan attributo definisce il numero di colonne cella di una tabella dovrebbe estendersi.
Si applica a
La colspan attributo può essere utilizzato sui seguenti elementi:
Elementi | Attributo |
---|---|
<td> | colspan |
<th> | 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>
Prova tu stesso " Th 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>
Prova tu stesso " Supporto per il browser
Il colspan
attributo ha la seguente supporto del browser per ogni elemento:
Elemento | |||||
---|---|---|---|---|---|
td | sì | sì | sì | sì | sì |
th | sì | sì | sì | sì | sì |