HTML Col Tag

Reference on the Col Element of HTML. Including its useful example, and a list of allowed attributes.

The col element, is used inside the table elements, to apply attributes to whole columns.

This element should be placed inside a table or colgroup element.

Attributes

Attribute:Value:Description:
AttrsOther AttributesCommon, Event, I18n
widthLength UnitSets the width of the column'(s).
spanNUMBERNumber of columns to effect.
cellhalignleft|center|right|justify|charhorizontal alignment in cells
cellvaligntop|middle|bottom|baselinevertical alignment in cells

The Span Attribute

This attribute controls how many columns to span, the default value is 1.

Example

<table style="width:100%;border:1px solid black;">
  <col style="background: silver;"> <!--Col 1-->
  <col style="background: gray;"> <!--Col 2-->
  <col style="background: green;"> <!--Col 3-->
  <tr>
    <td>Col 1</td>
    <td>Col 2</td>
    <td>Col 3</td>
  </tr>
  <tr>
    <td>HTML table</td>
    <td>col element</td>
    <td>tag</td>
  </tr>
  <tr>
    <td>HTML col</td>
    <td>Grouped attributes</td>
    <td>and</td>
  </tr>
</table>

Brugbart Vision!

Post comment

Links that you insert are not nofollowed, but will be removed by admins if they are considered spam.

[url=Absolute URL for page]TITLE[/url]

You should insert code boxes around code examples, which will be automatically syntax highlighted.

[code1 html|css|javascript|php|sql]Your Code Here[/code1]

You may want to read our Privacy Policy before submitting your comment.