HTML Tags

HTML <col> Tag

The <col> tag in HTML defines column properties for each column within a <colgroup> element.
It allows you to apply styling, width, or alignment to one or more columns of a table — without repeating the same style on each <td> or <th> individually.

Syntax

<col span="number" style="property:value;">

Attributes

AttributeDescription
spanSpecifies how many columns the <col> element should affect.
styleAdds inline CSS styling to the targeted columns (e.g., width, background color).
classApplies a CSS class to the defined columns for styling.
idSpecifies a unique ID for the column.

Example

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>HTML col Tag Example</title>
  <style>
    table {
      border-collapse: collapse;
      width: 60%;
    }
    th, td {
      border: 1px solid #333;
      padding: 8px;
      text-align: center;
    }
  </style>
</head>
<body>
  <h2>Example of the &lt;col&gt; Tag</h2>
  <table>
    <colgroup>
      <col span="1" style="background-color: #f2f2f2;">
      <col span="1" style="background-color: #d9f7be;">
      <col span="1" style="background-color: #ffd6e7;">
    </colgroup>
    <tr>
      <th>Product</th>
      <th>Price</th>
      <th>Stock</th>
    </tr>
    <tr>
      <td>Notebook</td>
      <td>$5</td>
      <td>120</td>
    </tr>
    <tr>
      <td>Pencil</td>
      <td>$1</td>
      <td>500</td>
    </tr>
  </table>
</body>
</html>

Output

Browser Output

There is visible output for this tag — though the <col> tag itself doesn’t render visible content,
it affects the appearance of entire columns through styles like background color or width.
Try it live in our TryIt Editor to experiment with different styles.

Browser Support

Chrome
Chrome
Firefox
Firefox
Edge
Edge
Safari
Safari
Opera
Opera
IE
IE9+
✅Yes✅Yes✅Yes✅Yes✅Yes✅Yes

💡 The <col> tag itself does not produce visible content; it affects how columns are displayed.

Notes

  • The <col> tag is always nested inside <colgroup>.
  • It is primarily used to style multiple columns efficiently.
  • The tag itself has no visible effect — only styling effects are reflected.
  • You can apply a class or id to customize multiple columns through external CSS.

Conclusion

The <col> tag defines styling or structural properties for table columns. It enhances maintainability by applying consistent styles across multiple cells. When used properly inside <colgroup>, it provides cleaner and more semantic table layouts.

Sign In Form

User your email and password to singn in

Provide your email and we will send you a password reset link.

Don’t have an account, signup here : 

HTML5 & CSS3

Tools and Tutorials

Want a Website

Want a website for your business ?

Please fill out the details below, so we can reach out to you.

Registration Form

Signup to track your record and much more.

We have sent you an email with a registration link. Please click the link to verify your email address, or enter the 6-digit OTP provided in the email.

Didn't receive the OTP. Regenerate OTP Resend