HTML Colgroup Tag | How To Specify Table Background Style?

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 Posts:

  • HTML abbr tag
  • HTML body tag
  • HTML address tag
  • HTML br tag
  • HTML bdo tag
  • HTML acronym tag
<< Previous Next >>

Từ khóa » Html Colgroup Background Color