HTML <colgroup> (Table Column Group) Tag

❮ Previous Reference Next ❯

Example

<table>
<colgroup>
  <col style="background-color:red">
  <col span="2" style="background-color:yellow">
</colgroup>
<tr>
  <th>No</th>
  <th>First Name</th>
  <th>Last Name</th>
</tr>
<tr>
  <td>01</td>
  <td>John</td>
  <td>Doe</td>
</tr>
<tr>
  <td>02</td>
  <td>Michael</td>
  <td>Jackson</td>
</tr>
</table>

Meaning

The <colgroup> element creates an explicit group of table columns containing col elements to provide for table column-level scripting or formatting.

Notes:

Version: HTML 4, 4.01, 5


Standard Syntax

<colgroup>...
</colgroup>



Browser Support




Status







Attributes

Attribute Value Description
span number span attribute specifies the default number of columns in this group.



Deprecated Attributes

Attribute Value Description
align left
center
right
justify
char
Specifies the horizontal alignment of each column cell content will be handled.
bgcolor color Specifies the background color of the table
char character Specifies the alignment of the content in a column group to a character.
charoff number Specifies the number of characters to offset the column data from the alignment character
valign baseline
bottom
middle
top
Specifies the vertical alignment of the text within each cell of the column.



Global Attributes

<colgroup> element also supports the Global Attributes in HTML.


Event Attributes

<colgroup> element also supports the Event Attributes in HTML.


By Default CSS Value(s)

Most of the browsers will display the <> element with the following by default value(s)

colgroup {
	display: table-column-group;
}



Related Tags:

<caption>, <col>, <table>, <tbody>, <td>, <tfoot>, <th>, <thead> and <tr>
❮ Previous Reference Next ❯