Home >> HTML 5 >> colgroup Tag in HTML 5

colgroup Tag in HTML 5

The <colgroup> tag specifies a group of one or more columns in a table for formatting.
 
Example
<!Doctype Html>  
<html>     
<head>      
       <title>Colgroup Tag</title>
</head>  
<body>   
<table width="200" height="200" border="1">
   <colgroup>
       <col style="background-color:green">
       <col style="background-color:red">
    </colgroup>
    <tr>
        <th>Name</th>
        <th>Age</th>
    </tr>
    <tr>
        <td>Ram</td>
        <td>22</td>
    </tr> 
    <tr>
        <td>Shyam</td>
        <td>24</td>
    </tr>
</table>
</body>  
</html>  
Output
Name Age
ram 22
shyam 24

Post Your Comment

Next Questions
data Tag
datalist Tag
dd Tag
del Tag
details Tag
dfn Tag
dialog Tag
dir Tag
div Tag
dl Tag
dt Tag
em Tag
embed Tag
fieldset Tag
figcaption Tag
figure Tag
font Tag
footer Tag
form Tag
frame Tag
frameset Tag
Heading Tag
head Tag
header Tag
hr Tag

Copyright ©2022 coderraj.com. All Rights Reserved.