<colgroup>
HTML <colgroup> 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 the <colgroup> tag .Tag definition and usage instructions<colgroup> Tags are used to group columns in the table in order to format them. By using the <colgroup> tag, you can apply styles to an entire column without having to repeatedly style each cell or row.
Note: can only be within the <table> element, after any <caption> element, and within any <thead>, <tbody>, < Use the <colgroup> tag before the tfoot> and <tr> elements.
Tip: If you want to define different attributes for a column in <colgroup>, please use the <col> tag inside the <colgroup> tag.
Differences between HTML 4.01 and HTML5Most attributes from HTML 4.01 are no longer supported in HTML5.
Properties
Value | Description | |
---|---|---|
left |
Right center Justify char | HTML5 is not supported. Specifies the horizontal alignment of content in column combinations. |
character | HTML5 Not supported. Specifies which character should be used to align the contents of the column group. | |
number | HTML5 Not supported. Specifies the offset of the first alignment character. | |
number | Specifies the number of columns that the column group should span.||
top |
middle bottom Baseline | HTML5 is not supported. Define the vertical alignment of content in a column combination. |
pixels
% relative_length | HTML5 Not supported. Specifies the width of the column combination. |