HTML/Elements/col

From Web Education Community Group
< HTML‎ | Elements
Jump to: navigation, search

<col>

The <col> element represents one or more columns in the column group represented by that colgroup.

Point

  • As a child of a colgroup element that doesn't have a span attribute.


HTML Attributes

  • span = valid non-negative integer

See also global attributes.


Examples

Example A

[try it]:

<table>
  <colgroup>
    <col></col>
    <col span="2" style="background-color: #ff0000;"></col>
  </colgroup>
  <tr>
    <td>1</td>
    <td>2</td>
    <td>3</td>
  </tr>
  <tr>
    <td>4</td>
    <td>5</td>
    <td>6</td>
  </tr>  
</table>

Col01.png

HTML Reference

The HTML5 specification defines the <col> element in 4.9.4 The col element.