I recently discovered that you can set the background color across table columns using the <colgroup>
tag.
table {
border: 2px solid;
border-collapse: collapse;
}
td {
border: 2px solid;
}
<table>
<colgroup>
<col span="3" style="background-color:silver">
<col span="2" style="background-color:green">
<col span="1" style="background-color:blue">
</colgroup>
<tr>
<td>Data</td>
<td>Data</td>
<td>Data</td>
<td>Data</td>
<td>Data</td>
<td>Data</td>
<td>Data</td>
</tr>
<tr>
<td>Data</td>
<td>Data</td>
<td>Data</td>
<td>Data</td>
<td>Data</td>
<td>Data</td>
<td>Data</td>
</tr>
</table>
The code above will give silver background to first three columns, green to the next two, and blue to the last column.
My question now is, can I apply other styles, specifically the font-family
, to multiple columns in a similar way? If yes, how?