In this illustration we will inform you about the use and implementation of <col> tag in html5. The <col> tag is used for defining the properties of one or more columns in the table. This tag is used to apply styles to columns rather than changing the properties of each cell one by one. This tag is used only if the properties of each column is different, otherwise we can use <colgroup> tag for defining the properties. This tag must be used within table or colgroup element. This tag is an empty tag.
|<col span="value" />|
There is only one element specific attribute. Other attribute of html4.01 is not supported by html5 (according html5 specification).
Attribute: span This attribute defines the number of column to span. The value of the attribute is a valid no. of columns in a table.
In this code we have used style attribute to set the background color of the columns.
<title>Example of Col Tag</title>
<col span="1" style="background:#ffffcc" />
<col span="1" style="background:pink" />
Recommend the tutorial