|
|
The tag specifies column properties for each column within a element. The tag is useful for applying styles to entire columns, instead of repeating the styles for each cell, for each row. |
<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>
| Attribute | Value | Description |
|---|---|---|
| span | number | Specifies the number of columns a <col> element should span |
<style>
table, th, td {
border: 1px solid black;
}
col {
display: table-column;
}
</style>
Here, the first two columns should have a background color of red.
The span attribute defines the number of columns a <col> element should span.

<col span="number">
| Value | Description |
|---|---|
| number | Sets the number of columns a <col> element should span |
<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>
<tr>
<td>5869207</td>
<td>My first CSS</td>
<td>$49</td>
</tr>
</table>
Category: | Web Tutorial |
Sub Category: | HTML Tag |
Uploaded by: | Admin |
Read Articlehttps://develop.horje.com/learn/1434/reference