html Col tag

In the html <col> tag is used to identify attribute values for one or many columns in the table and you can use style element for this tag. It can use many <col> tag inside of table.In the <col> tag is an empty tag. 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