groups of table columns


<colgroup>

Browser
Internet Explorer Firefox Opera7

The COLGROUP element defines groups of table columns.


<colgroup span="3"></colgroup>


Attribute Value Explanation
span=" " number number of columns in group

The default is "1".

You can specify the following attributes for each group.

Attribute Value Explanation
width=" " pixels or % the width of the column Internet ExplorerFirefoxOpera7
align=" " horizontal alignment in cell Internet ExplorerOpera7
left aligns to the left
center aligns to the center
right aligns to the right
valign=" " vertical alignment in cell Internet ExplorerOpera7
top aligns to the top
middle aligns to the middle
bottom aligns to the bottom

The position where the COLGROUP element is placed

<table>
<caption>Table caption</caption>
<colgroup span="1"></colgroup>
<colgroup span="2"></colgroup>
<thead>
<tr>
<th>Group A</th><th>Group B</th><th>Group B</th>
</tr>
</thead>
<tfoot>
<tr>
<td>Group A</td><td>Group B</td><td>Group B</td>
</tr>
</tfoot>
<tbody>
<tr>
<td>Group A</td><td>Group B</td><td>Group B</td>
</tr>
</tbody>
</table>


Example

<table border="1">

<colgroup align="center" width="250" style="background-color: #80ff80"></colgroup>
<colgroup span="3" align="right" width="120" style="background-color: #ffffff"></colgroup>

<tr>
<td>Group A</td>
<td>Group B</td>
<td>Group B</td>
<td>Group B</td>
</tr>
<tr>
<td>Group A</td>
<td>Group B</td>
<td>Group B</td>
<td>Group B</td>
</tr>
<tr>
<td>Group A</td>
<td>Group B</td>
<td>Group B</td>
<td>Group B</td>
</tr>
</table>
Output
Group A Group B Group B Group B
Group A Group B Group B Group B
Group A Group B Group B Group B