HTML Colgroup Tag | How To Specify Table Background Style?

Last Updated on April 26, 2023 by Roshan Parihar

HTML colgroup tag is used to specify table background styles.

The colgroup tag defines the column background of table with HTML col tag.

Syntax

Syntax <colgroup>Put colgroup element here...</colgroup>
1 <colgroup>Put colgroup element here...</colgroup>
Example <table border="1"> <caption>This is the table caption</caption> <colgroup> <col style="background-color:green"> <col style="background-color:yellow"> </colgroup> <tr> <th>Company Name</th> <th>Description</th> </tr> <tr> <td>Infosys</td> <td>Infosys is a software company</td> </tr> </table>
123456789101112131415 <table border="1"><caption>Thisisthe table caption</caption><colgroup><col style="background-color:green"><col style="background-color:yellow"></colgroup><tr><th>Company Name</th><th>Description</th></tr><tr><td>Infosys</td><td>Infosys isasoftware company</td></tr></table>

Output

This is the table caption
Company Name Description
Infosys Infosys is a software company

Resources and References of HTML colgroup tag

1. W3C Specification. 2. HTML living standard 3. W3C project using Github

Related

Related Posts:

  • HTML blockquote tag
  • HTML abbr tag
  • HTML aside tag
  • HTML <!DOCTYPE> tag
  • HTML <a> Tag
  • HTML br tag
<< Previous Next >>

Từ khóa » Html Colgroup Background Color