<col>
HTML <col> Tag
Instance
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>php中文网(php.cn)</title> </head> <body> <table border="1"> <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></td> </tr> <tr> <td>5869207</td> <td>My first CSS</td> <td></td> </tr> </table> </body> </html>
Run Example»
Click the "Run Instance" button to view the online instance
Browser support
All major browsers support< col> tag.
Tag definition and usage instructions
<col> tag specifies the column attributes of each column inside the <colgroup> element.
By using the <col> tag, you can apply a style to an entire column without having to repeatedly set the style for each cell or row.
Differences between HTML 4.01 and HTML5
Most attributes from HTML 4.01 are no longer supported in HTML5.
Differences between HTML and XHTML
In HTML, the <col> tag does not have a closing tag.
In XHTML, the <col> tag must be closed correctly.
Properties
Properties | Value | Description |
---|---|---|
align | left Right center Justify char | HTML5 is not supported. Specifies the horizontal alignment of content related to the <col> element. |
char | character | HTML5 Not supported. Specifies which character is used to align content related to the <col> element. |
charoff | number | HTML5 Not supported. Specifies the offset of the first alignment character. |
span | number | Specifies the number of columns the <col> element should span. |
valign | top middle bottom Baseline | HTML5 is not supported. Specifies the vertical alignment of content associated with the <col> element. |
width | % pixels Relative_length | HTML5 is not supported. Specifies the width of a <col> element |
##Global attribute<col> tag supports HTML Global properties.
Event attributes<col> tag supports HTML event attributes.