Tables

HTML <col> Tag

The <col> tag specifies column properties for each column within a <colgroup> element.

Definition and Usage

The <col> tag specifies column properties for each column within a <colgroup> element.

Standard Syntax:<col>

Interactive ExampleRunnable

HTML <col> Example

html
Try it Yourself
Live code demonstration for the <col> tag. Click "Try it Yourself" to edit and experiment in real time.
<div style="font-family: system-ui, sans-serif; padding: 16px; background: #ffffff; border-radius: 8px; border: 1px solid #e2e8f0; color: #0f172a;">
<table>

  <colgroup>

    <col span="2" style="background-color:red">

    <col style="background-color:yellow">

  </colgroup>

  <tr>

    <th>ISBN</th>

    <th>Title</th>

    <th>Price</th>

  </tr>

  <tr>

    <td>3476896</td>

    <td>My first HTML</td>

    <td>$53</td>

  </tr>

 </table>
</div>

Attributes for <col>

1 Supported Attributes
AttributeValuesDefaultDescription
spannumbernoneSpecifies the number of columns a <col> element should span
Global Attributes

The <col> tag also supports the standard global attributes in HTML, including class, id, style, title, hidden, and data-*.

HTML Global Attributes Reference →
Event Attributes

The <col> tag supports event attributes in HTML, such as onclick, onmouseover, onfocus, and more.

HTML Event Attributes Reference →

Browser Compatibility

ChromeEdgeFirefoxSafariOpera

More Tags in Tables

View All 123Tags →