HTML colgroup tag and element

HTML colgroup element

1. HTML colgroup (column group) element represents a structural division of an HTML table.

2. A colgroup starts with <colgroup> tag. And ends with </colgroup> tag, which is optional.

3. Using colgroup is useful when you want to apply certain style or attributes to a number of table columns.




HTML colgroup element is a part of HTML Tables.

Whether both start and end tags are required

Start tag is required but end tag is optional.

Can contain

HTML colgroup element can contain one or more tr elements.

Can reside within

HTML colgroup element can reside within table element.


span, width.


id, class.

language information and text direction

lang, dir.






onclick, ondblclick, onmousedown, onmouseup, onmouseover, onmousemove, onmouseout, onkeypress, onkeydown, onkeyup.

Cell alignment

align, char and charoff attributes.

Supported doctypes

HTML 4.01 Strict, HTML 4.01 Transitional, and HTML 4.01 Frameset.

Example of using HTML colgroup element

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Example of HTML  colgroup element</title>
<table width="100%" border="1"><colgroup span="2"></colgroup>
<td>Subroto Dey. </td>
<td>Regional head, Sales </td>


html colgroup element

View this example in a separate browser window

HTML colgroup tag example.

Pictorial presentation


Previous: HTML tbody tag and element
Next: HTML col tag and element

Test your Programming skills with w3resource's quiz.

Follow us on Facebook and Twitter for latest update.

We are closing our Disqus commenting system for some maintenanace issues. You may write to us at reach[at]yahoo[dot]com or visit us at Facebook