HTML: <COL> vs. <COLGROUP> – What’s the difference between the table tags COL and COLGROUP?

by Yang Yang on April 4, 2009

Share This Article:
Subscribe to Kavoir: blog feed

As we all know, HTML tables have a way to distinguish between columns and groups of them to do things about them and that is the COL tag and the COLGROUP tag.

They pretty much have exactly the same set of available attributes – they are almost identical except for the names they are born with. Now what’s the difference between them really?

The only difference between COL tag and COLGROUP tag is the semantic nuances. While COL can surely span across multiple table columns, COLGROUP provide a more semantic meaning in the same task by grouping them with meanings – that is column groups with table columns related to each other in some nature.

Reference: http://www.w3.org/TR/html401/struct/tables.html#h-11.2.4

Share This Article:
Subscribe to Kavoir: blog feed

You should also read:

{ 2 comments… read them below or add one }

Habeeb Perwad June 12, 2010 at 10:50 am

I can’t understand the difference.
Please explain in detail.
Add some examples.

Reply

ShoobyD October 14, 2010 at 7:31 pm

there’s a more practical difference between the two tags.
the ‘col’ tag can be used inside a ‘colgroup’ tag, so you can create sub-groups of column groups.
‘colgroup’ can have ‘col’ tags inside it (and only them, you can’t put ‘colgroup’ inside ‘colgroup’), unlike the ‘col’ tag that is always empty.

Reply

Leave a Comment

Previous post:

Next post: