HTML CSS Bootstrap Javascript Icons Python
HTML References
HTML - Tag Reference HTML - Tag by Category HTML - Attributes HTML - Global Attributes HTML - Events HTML - Language Codes HTML - Country Codes HTML - URL Encoding HTTP Methods HTTP Status Codes <input> types
All HTML Tags
<!-- --> <!DOCTYPE> <a> <abbr> <acronym> <address> <applet> <area> <article> <aside> <audio> <b> <base> <basefont> <bdi> <bdo> <big> <blockquote> <body> <br> <button> <canvas> <caption> <center> <cite> <code> <col> <colgroup> <data> <datalist> <dd> <del> <details> <dfn> <dialog> <dir> <div> <dl> <dt> <em> <embed> <fieldset> <figcaption> <figure> <font> <footer> <form> <frame> <frameset> <h1> - <h6> <head> <header> <hr> <html> <i> <iframe> <img> <input> <ins> <kbd> <label> <legend> <li> <link> <main> <map> <mark> <meta> <meter> <nav> <noframes> <noscript> <object> <ol> <optgroup> <option> <output> <p> <param> <picture> <pre> <progress> <q> <rp> <rt> <ruby> <s> <samp> <script> <section> <select> <small> <source> <span> <strike> <strong> <style> <sub> <summary> <sup> <svg> <table> <tbody> <td> <template> <textarea> <tfoot> <th> <thead> <time> <title> <tr> <track> <tt> <u> <ul> <var> <video> <wbr>

HTML <colgroup> tag

The HTML <colgroup> element defines a group of columns within a table.

This element is useful for applying styles to entire columns, instead of repeating the styles for each cell, for each row.

Run code

Browser compatibility

The <colgroup> element is fully supported by all browsers:

Element
<colgroup> yes yes yes yes yes



Attributes

The following table shows the attributes that are specific to the <colgroup> tag:

Attribute Value Description
align left
right
center
justify
char
Not supported in HTML5.
Aligns the content in a column group
char character Not supported in HTML5.
Aligns the content in a column group to a character
charoff number Not supported in HTML5.
Sets the number of characters the content will be aligned from the character specified by the char attribute
span number Specifies the number of columns a column group should span
valign top
middle
bottom
baseline
Not supported in HTML5.
Vertical aligns the content in a column group
width pixels Not supported in HTML5.
Specifies the width of a column group

Global Attributes

The <colgroup> tag supports the global attributes described in HTML Global Attributes Reference

Event Attributes

The <colgroup> tag supports the event attributes described in HTML Events Reference


More Examples

The following example set the background color of the first 3 columns using the span attribute:

Run code

Last updated: Tuesday 18 Sep, 2018