CodeLab
Tutorials For Everyone
Run
<!Doctype HTML> <html> <head> <title>Table colgroup</title> <style> table, th, td{ border: 1px solid #999; border-collapse: collapse; } th, td{ padding: 10px; } </style> </head> <body> <h2>HTML table colgroup</h2> <p>Colgroup takes col tags to group the table columns. Then we can specify the styles for columns.</p> <table style="width: 100%;"> <caption>Users Ids and Passwords</caption> <colgroup> <col span="2" style="background-color: blue;"> <col style="background-color: red;"> </colgroup> <tr> <th>User</th> <th>ID</th> <th>Password</th> </tr> <tbody> <tr> <td>joh</td> <td>john_123</td> <td>iAMjon_123</td> </tr> <tr> <td>Nikita</td> <td>niki_007</td> <td>007_niki</td> </tr> <tr> <td>Maria</td> <td>maria</td> <td>maria-9987</td> </tr> <tr> <td>Adam</td> <td>adam187</td> <td>noBodyLikesMe_187</td> </tr> </tbody> </table> </body> </html>