HTML Tag Reference - HTML tag <col>








This <col> element specifies the properties of a column in a <table>.

Browser compatibility

<col> Yes Yes Yes Yes Yes

What's new in HTML5

Some of the attributes in HTML 4.01 are not supported in HTML5.

Attribute

align
Value:left|right|center|justify|char
Not supported in HTML5. Set the alignment.
char
Value:character
Not supported in HTML5. Set the alignment to a character.
charoff
Value:number
Not supported in HTML5. Set the number of characters the text will be aligned from the character specified by the char attribute.
span
Value:number
Set the number of columns a col element should span
valign
Value:top|middle|bottom|baseline
Not supported in HTML5. Set the vertical alignment
width
Value:%|pixels|relative_length Not supported in HTML5. Set the width

Global Attributes

The <col> tag supports the Global Attributes in HTML.





Event Attributes

The <col> tag supports the Event Attributes in HTML.

Default CSS Settings

col { 
    display: table-column;
}

Example

A demo showing how to use <col> tag.

<html>
<body>
     <table>
          <col style="color: maroon">
          <col style="color: red">
          <tr>
               <td>col 1: maroon</td>
               <td>col 2: red</td>
          <tr>
               <td>col 1: maroon</td>
               <td>col 2: red</td>
          </tr>
     </table>
</body><!-- ww w  . j  ava 2  s . c  o  m-->
</html>

Click to view the demo