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: |
| Attrs | Other Attributes | Common, Event, I18n |
| width | Length Unit | Sets the width of the column'(s). |
| span | NUMBER | Number of columns to effect. |
| cellhalign | left|center|right|justify|char | horizontal alignment in cells |
| cellvalign | top|middle|bottom|baseline | vertical 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>