Home Tutorial Html Html5 HTML5 col tag, Introduction to <col>tag in html5

 
 

Share on Google+Share on Google+
HTML5 col tag, Introduction to <col>tag in html5
Posted on: September 6, 2010 at 12:00 AM
Advertisement
In this illustration we will inform you about the use and implementation of  <col>tag in html5

HTML5 col tag, Introduction to <col> tag in html5.

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.

Declaration syntax:

<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.

Example: Col.html

<!DOCTYPE html>
<html>
<head>
<title>Example of Col Tag</title>
</head>
<body>
<table border="1">
<caption>
<b>Col Tag</b></caption>
<col span="1" style="background:#ffffcc" />
<col span="1" style="background:pink" />
<tr>
     <th>Employee</th>
   <th>DOB</th>
</tr>
<tr>
   <td>Gyan singh</td>
   <td>1-3-87</td>
</tr>
</table>
</body> 
</html>

Output:

Download This Example:

Advertisement

Related Tags for HTML5 col tag, Introduction to <col>tag in html5:


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: September 6, 2010

Recommend the tutorial

Advertisements Advertisements
 

 

 

DMCA.com