HTML <col> Tag
Description:
The <col> tag defines attribute values for one or more columns in a table.
The <col> tag is useful for applying styles to entire columns, instead of repeating the styles for each cell, for each row.
The <col> tag can only be used inside a table or a colgroup element.
Specific Attributes:
| Attribute | Definition |
| name | Marks an area of the page that a link jumps to. |
| span | Specifies how many columns to span. |
| width | Width of the column. |
Other Attributes:
| Attribute | Definition |
| dir |
Specifies the text direction for the content in
an element.
|
| class | Specifies a classname for an element. |
| id | Specifies a unique id for an element. |
| lang | Specifies a language code for the content in an element. |
| title | Specifies a title to associate with the element. Many browsers will display this when the cursor hovers over the element (similar to a "tool tip"). |
| style | Specifies an inline style for an element. |
| align | Specifies the alignment of the content related to a col element. |
| valign | Specifies the vertical alignment of the content related to a col element. |
| char | Specifies the alignment of the content related to a col element to a character. |
| charoff | Specifies the number of characters the content will be aligned from the character specified by the char attribute. |
Example Code:
<table width="100%" border="1">
<col align="left"></col>
<col align="left"></col>
<col align="right"></col>
<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>
Result
| ISBN | Title | Price |
|---|---|---|
| 3476896 | My first HTML | $53 |