Open In App

HTML | <colgroup> span Attribute

Last Updated : 21 Jul, 2022
Improve
Improve
Like Article
Like
Save
Share
Report

The HTML <colgroup> span Attribute is used to define the number of column that a <colgroup> element should span. 

Syntax:

<colgroup span="number">

Attribute Values:

  • number: It contains the numeric value which specifies the number of col element should span.

Example: 

html




<!DOCTYPE html>
<html>
 
<head>
    <title>
        HTML ColumnGroup span Attribute
    </title>
 
    <style>
        #myColGroup {
            background: green;
        }
         
        table {
            color: white;
            margin-left: 180px;
            background: yellow;
        }
         
        #Geek_p {
            color: green;
            font-size: 30px;
        }
         
        td {
            padding: 10px;
        }
    </style>
</head>
 
<body style="text-align:center;">
 
    <h1 style="color:green;">
            GeeksForGeeks
        </h1>
 
    <h2>
      HTML ColumnGroup span Attribute
  </h2>
 
    <table>
        <colgroup id="myColGroup" span="2">
      </colgroup>
        <tr>
            <th>S.No</th>
            <th>Title</th>
            <th>Geek_id</th>
        </tr>
        <tr>
            <td>Geek_1</td>
            <td>GeekForGeeks</td>
            <th>Geek_id_1</th>
        </tr>
        <tr>
            <td>Geek_2</td>
            <td>GeeksForGeeks</td>
            <th>Geek_id_2</th>
        </tr>
    </table>
</body>
 
</html>


Output:

  

Supported Browsers: The browsers supported by HTML <colgroup> span Attribute are listed below:

  • Google Chrome 1
  • Edge 12
  • Internet Explorer
  • Firefox 1
  • Apple Safari
  • Opera


Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads