HTML <colgroup> alignAttribute
Examples
Two <colgroup> elements specify different alignments for three columns in a table (note that the first <colgroup> element spans two columns):
<table width="100%" border="1">
<colgroup span="2" align="left"></colgroup>
<colgroup align="right"></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>
<colgroup span="2" align="left"></colgroup>
<colgroup align="right"></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>
Try it Yourself »
Browser Support
![]()
![]()
![]()
![]()
![]()
Only Opera and Internet Explorer 8 and earlier versions support the align attribute (IE 9 does not support it).
Definition and Usage
In HTML5, the <colgroup> align attribute is not supported.
The align attribute specifies the horizontal alignment of content within the column group.
Syntax
<colgroup align="left|right|center|justify|char">
Attribute Values
| Value | Description |
|---|---|
| left | Left-aligns content (default value). |
| right | Right-aligns content. |
| center | Center-aligns content (default value for th elements). |
| justify | Stretches the lines so that each line has equal width (like in newspapers and magazines). |
| char | Aligns content to a specified character. |
HTML <colgroup> Tag Other Extensions