HTML colgroup Tag

HTML colgroup Tag


Define :
It is defined or specifies a group of one or more columns in a table for formatting and it is useful for applying styles to entire columns.
This tag must be a child of a <table> element like <tr>, <thead>, <tbody>, <th>, <td>.
For Example :


Output :
                     
Browser Support
All browsers are supported like opera, firefox, chrome, Microsoft edge

Global and Event Attributes
This tag also supports the Global and Event Attributes in HTML.

Attributes
Attribute
Description
span
It is defined as the number of columns a <col> element should span
 
 
  • Align text in table columns with the help of CSS.
Example

Output :
 
  • Vertical-align text in table columns in CSS
Example :


Output :
              
  • It is specified width of table columns in CSS
Example :

Output :
               
Default CSS Settings
Most browsers will display the <col> element in css

colgroup {
  display: table-column-group;
}