Spread the love

The HTML <Colgroup> Tag associate degree specifies the cluster of columns within the HTML table. It uses one’s parent instrumentality or multiple <col> gap components to use completely different properties in an associate degree HTML table.

Note:- The <Colgroup> Tag should be used after the <caption> with the <table> part and before the <thead> or <tbody> elements.

Example:-

<!DOCTYPE html>
<html>
<head>
   <meta charset="utf-8">
   <title>
      HTML colgroup tag
   </title>
</head>
<body>
<h1>This is HTML colgroup Tag Example</h1>
<table border="1">
  <colgroup>
    <col span="2" style="background-color:red;">
    <col span="1" style="background-color:yellow;">
  </colgroup>
  <tr>
    <th>Roll No.</th>
    <th>Name</th>
    <th>Grade</th>
  </tr>
  <tr>
    <td>3476896</td>
    <td>Khushal</td>
    <td>A+</td>
  </tr>
</table>
</body>
</html>

Output:-


Spread the love

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *