HTML span atribut
Definice a použití
Atribut span
definuje počet sloupců, které by měl prvek
<col>
nebo <colgroup>
prvek zahrnovat.
Platí pro
Atribut span
lze použít u následujících prvků:
Prvky | Atribut |
---|---|
<col> | rozpětí |
<colgroup> | rozpětí |
Příklady
Col Příklad
Zde by první dva sloupce měly mít barvu pozadí červenou:
<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>
Příklad Colgroup
Nastavte barvu pozadí prvních dvou sloupců pomocí atributu span <colgroup>:
<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>
Podpora prohlížeče
Atribut span
má následující podporu prohlížeče pro každý prvek:
Element | |||||
---|---|---|---|---|---|
col | Yes | Yes | Yes | Yes | Yes |
colgroup | Yes | Yes | Yes | Yes | Yes |