HTML col tag

HTML col tag defines one or more columns in a table. col element is the child of colgroup. It takes part in making the model of a table.

Example

Countries Population Area
Philippines 104,918,090 300,000
Mexico 129,163,276 1,964,375
Try </>

Specific uses

The purpose of col element is to style indivisual columns instead of rows. More than one columns can be styled using span attribute.

Related tags

TagsDescription
<colgroup> colgroup element tag groups all of the columns.
<colgroup> <col> group of columns </col> </colgroup>
<table> table element represents data in the form of table.
<table> Table Data </table>
<tr> tr element defines a table row.
<table> <tr><td> Table row </td></tr> </table>
<td> td element defines table data in the table.
<table> <tr><td> a cell of data </td></tr> </table>

Tag omission

col tag is self closing tag (<col />) i.e. there is no end tag.

Global Attributes

All the global attributes are applicable on the <col> tag.

Specific Attributes

<col> tag attributes

AttributesDescription
span It allows a <col> tag to span more than one columns. Its value is a positive integer.
<colgroup> <col span="3"></col> </colgroup>


Was this article helpful?

 

Email:

Message:

Get the newsletter