The col tag in HTML
- 24-07-2022
- Trung Minh
- 0 Comments
The <col> tag specifies an attribute for each column in a <colgroup> element.
The <col> tag is especially useful for applying styles to entire columns instead of having to repeat each cell and row.
How to use the <col> . tag
For example , use the <col> tag to colorize columns.
<table> <colgroup> <col span="1" style="background-color:red"> <col style="background-color:yellow"> </colgroup> <tr> <th>ISBN</th> <th>Title</th> <th>Price</th> </tr> <tr> <td>3476896</td> <td>My first HTML</td> <td>$53</td> </tr> <tr> <td>5869207</td> <td>My first CSS</td> <td>$49</td> </tr> </table>
Attribute of the <col> . tag
The <col> tag is provided with all the Global Attributes in HTML.