Web development

HTML col tag & colgroup tag

HTML col tag & colgroup tag

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

The HTML <colgroup> element defines a group of one or more columns in a table for formatting.

The HTML <col> element like the <colgroup> element can be used to apply styles to entire columns (instead of repeating the styles for each cell, or a row).


<!DOCTYPE html>
table, th, td {
  border: 3px solid #333;
table {
  border-collapse: collapse;

    <col span="2" style="background-color:#e9c46a">
    <col style="background-color:#2a9d8f">
    <td>HTML course</td>
    <td>CSS course</td>



Number Title Price
25 HTML course £45
27 CSS course £69

Enjoy coding!

Read also:

HTML List Tags

HTML tbody tag, thead tag & tfoot tag

CSS Columns