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
You should also read:
- Semantic HTML Table Checklist – For The Sake of SEO!
- SQL: CREATE TABLE … SELECT … to generate new table from existing tables
- MySQL: Deleting Duplicate Rows or Records | Selecting Unique Rows into A New Table
- MySQL: INSERT INTO … SELECT … FROM … Selectively on Table Columns / Fields to Combine Multiple Tables into One
- MySQL: Counting Number of Records or Rows by a Foreign Column (from Another Table)


Facebook
Twitter
Google Plus
{ 2 comments… read them below or add one }
I can’t understand the difference.
Please explain in detail.
Add some examples.
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.