HTML <colgroup> tag

Usage

Defines a group of table columns.

Example

Code:

<table border="1">
<colgroup span="4">
<col width="30"></col>
<col width="20"></col>
<col width="10"></col>
<col width="50"></col>
</colgroup>

<tr>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
</tr>
</table>

Output:

1 2 3 4

Required Attributes

  • none

Optional Attributes

  • align - right, left, center, justify, char - alignment of text within the column
  • char - specifies the character that the text should be aligned around; not supported by many browsers
  • charoff - the number of pixels to offset the alignment by; again not supported by many browsers
  • span - specifies how many columns the <col> tag should span
  • valign - top, middle, bottom, baseline - vertical alignment of the cell text
  • width - width of the column

Core Attributes