HTML Tutorial
Group columns of a table to apply common attributes.
<colgroup>
tag within the <table>
tag.<col>
tag within the <colgroup>
tag to define each column.<col>
tag.<colgroup>
:<col>
:Group two columns and set their width:
<table>
<colgroup span="2" width="50%">
<col>
<col>
</colgroup>
<tr>
<td>Col 1</td>
<td>Col 2</td>
</tr>
</table>
Align content in a column:
<colgroup>
<col align="center">
<col>
</colgroup>
Merge multiple columns:
<colgroup>
<col span="3">
<col>
</colgroup>
Exploring the <colgroup>
Tag:
HTML Code:
<table>
<colgroup span="2" width="50%">
<col>
<col>
</colgroup>
<tr>
<th>Col 1</th>
<th>Col 2</th>
</tr>
<tr>
<td>Data 1</td>
<td>Data 2</td>
</tr>
</table>
Creates a table with two groups of columns, where each group has a width of 50%.