Html 5 Col tag

In the html5 <col> tag is used to identify attribute values for one or more columns in the table and you can use style element for this tag. It can use inside of table or colgroup element and many html 4.01 attributes are not support for html 5.

In the col element is an empty element. When you want to same attribute column in different place use to <col> tag.

Syntax:

<table>
  <colgroup>
    <col></col>
  </colgroup>
</table>

Example Code

<table border="1">
<colgroup span="1" style="background-color:#0000CC">
  <col width="50"></col>
  <col width="100"></col>
</colgroup>
<tr>
  <td>col 1</td>
  <td>col 2</td>
  <td>col 3</td>
</tr>
</table>

Out Put:



col 1 col 2 col 3

In the above example <col> tag has been added to inside of table.In the first col tag is a small size and second col is a big size and third col is a normal size.





Content