HTML CSS examples for HTML Tag:col
The span attribute sets the number of columns a <col> element should span.
Value | Description |
---|---|
number | Sets the number of columns a <col> element should span |
Here, the first two columns should have a background color of red:
<!DOCTYPE html> <html> <head> <style> table, th, td { border: 1px solid black; } </style><!--from ww w . j a v a 2 s. co m--> </head> <body> <table> <colgroup> <col span="2" style="background-color:red"> <col style="background-color:yellow"> </colgroup> <tr> <th>ISBN</th> <th>Title</th> <th>Price</th> </tr> <tr> <td>3</td> <td>My first HTML</td> <td>$2</td> </tr> <tr> <td>5</td> <td>My first CSS</td> <td>$1</td> </tr> </table> </body> </html>