Definizione e utilizzo
L' span attributo definisce il numero di colonne di un <col>/<colgroup> elemento dovrebbe estendersi.
Si applica a
La span attributo può essere utilizzato sui seguenti elementi:
Elementi | Attributo |
---|---|
<col> | span |
<colgroup> | span |
Esempi
Col Esempio
Qui, le prime due colonne devono avere un colore di sfondo rosso:
<table>
<colgroup>
<col span="2" style="background-color:red">
<col style="background-color:yellow">
</colgroup>
<tr>
<th>ISBN</th>
<th>Title</th>
<th>Price</th>
</tr>
<tr>
<td>3476896</td>
<td>My first HTML</td>
<td>$53</td>
</tr>
</table>
Prova tu stesso " Colgroup Esempio
Impostare il colore delle prime due colonne usando lo sfondo <colgroup> attributo arco:
<table>
<colgroup span="2" style="background:red"></colgroup>
<tr>
<th>ISBN</th>
<th>Title</th>
<th>Price</th>
</tr>
<tr>
<td>3476896</td>
<td>My first HTML</td>
<td>$53</td>
</tr>
<tr>
<td>5869207</td>
<td>My first CSS</td>
<td>$49</td>
</tr>
</table>
Prova tu stesso " Supporto per il browser
L' span
attributo ha la seguente supporto del browser per ogni elemento:
Elemento | |||||
---|---|---|---|---|---|
col | sì | sì | sì | sì | sì |
colgroup | sì | sì | sì | sì | sì |