Tables

HTML <col> element

Represents one or more table columns within a colgroup without individual cell content. Only certain CSS properties apply to columns. A col describes table columns for permitted CSS properties and span. It does not contain cells and cannot be used to attach semantic header text. It accepts global HTML attributes; individual global features may be inapplicable or restricted.

Formal Syntax & Structure

html syntaxhtml
<col span="2">

Parameters & Attributes

NameTypeDescription
spanpositive integerSpecifies how many columns a col or applicable colgroup represents. The default is 1; colgroup with span must not also contain col children.

Return Value

HTMLTableColElement

Content model: Empty; this void element cannot contain children and must not have an end tag. No closing tag.

Working Example

Example Snippethtml
<!doctype html><html lang="en">  <head>    <meta charset="utf-8">    <title>HTML example</title>  </head>  <body>    <table>      <colgroup>        <col>        <col>      </colgroup>      <tr>        <th scope="col">Item</th>        <th scope="col">Count</th>      </tr>      <tr>        <td>Books</td>        <td>2</td>      </tr>    </table>  </body></html>
HTML Reference