![]() |
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. |
Example:
HTML
<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 |
Example:
HTML
<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 |
Example:
HTML
<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>
How to create HTML <col> Tag | HTML Tag |
What Type of Browsers will Support for HTML <col> Tag | HTML Tag |
Attributes for HTML <col> Tag | HTML Tag |
How to set Default CSS Settings for HTML <col> Tag | HTML Tag |
How to add HTML <col> span Attribute | HTML Tag |
Read Full: | HTML Tag |
Category: | Web Tutorial |
Sub Category: | HTML Tag |
Uploaded by: | Admin |
Views: | 98 |
Reffered: https://www.w3schools.com/tags/tag_col.asp