- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
HTML Tag
The col tag in HTML is used to set column properties for each column. These columns should be within a <colgroup> element.
Following is the attribute −
- span: The number of columns a <col> element should span
Let us now see an example to implement the col tag in HTML −
Example
<!DOCTYPE html> <html> <head> <style> table, th, td { border: 2px solid black; } </style> </head> <body> <h2>ICC Rankings</h2> <table> <colgroup> <col span="2" style="background-color:magento;"> <col style="background-color:blue;"> </colgroup> <tr> <th>Player</th> <th>Country</th> <th>Rank</th> </tr> <tr> <td>Jack</td> <td>WI</td> <td>1</td> </tr> <tr> <td>Tom</td> <td>AUS</td> <td>2</td> </tr> <tr> <td>Virat</td> <td>IND</td> <td>3</td> </tr> <tr> <td>Steve</td> <td>AUS</td> <td>4</td> </tr> <tr> <td>Kane</td> <td>NZ</td> <td>5</td> </tr> <tr> <td>David</td> <td>AUS</td> <td>6</td> </tr> </table> </body> </html>
Output
Advertisements