Jitendra Vyas
Jitendra Vyas

Reputation: 152677

How to use <col> tag correctly and is it supported in all browser?

What is the use of <col> tag and is it supported in all browser?

I was trying <col style="background:red"> but it's not working. I'm on Firefox 3.

<table width="100%" border="1">
  <col style="background:red">
  <caption> Table Caption </caption>

Upvotes: 6

Views: 8549

Answers (2)

Guffa
Guffa

Reputation: 700342

It works, but it doesn't affect the caption. Working example:

<html>
<head>
<title></title>
</head>
<body>

<table>
  <caption>test</caption>
  <col style="background:red" />
  <col style="background:blue" />
  <tr>
    <td>red</td>
    <td>blue</td>
  </tr>
  <tr>
    <td>red</td>
    <td>blue</td>
  </tr>
</table>

</body>
</html>

The tag is defined in HTML 4.01 (1997) and not deprecated in XHTML, so it should be supported (as far as the user interface allows) by every current browser on any platform.

Upvotes: 5

VoodooChild
VoodooChild

Reputation: 9784

It is used in tables to set default attributes for all the cells in a column or a group of columns.

The col tag is defined in an ordered way and can be part of a HTML colgroup tag or not.

It is supported in all browsers.

Upvotes: 2

Related Questions