Categories
CSS & HTML Tips

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

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

By Yang Yang

Hello, I'm Yang. I build online businesses that please people. Want to join in and post some useful articles on Kavoir.com? Shoot me a message.

3 replies on “HTML: <COL> vs. <COLGROUP> – What’s the difference between the table tags COL and COLGROUP?”

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.

Comments are closed.