The nth-last-col CSS pseudo-class represents a cell element belonging to a column that has An+B-1 columns after it, for any positive integer or zero value of n.
selector:nth-last-col(An+B)
{
property: value;
}
<!doctype html>
<html>
<head>
<style>
table, td
{
border-style: solid;
}
tr:nth-last-col(even)
{
background-color: yellow;
}
</style>
</head>
<body>
<table>
<col span="2">
<col>
<col>
<tr>
<td>even</td>
<td>even</td>
<td>even</td>
<td>even</td>
</tr>
<tr>
<td colspan="2">even</td>
<td>even</td>
<td>even</td>
</tr>
<tr>
<td>even</td>
<td colspan="2">even</td>
<td>even</td>
</tr>
<tr>
<td>even</td>
<td>even</td>
<td colspan="2">even</td>
</tr>
</table>
</body>
</html>
<!doctype html>
<html>
<head>
<style>
table, td
{
border-style: solid;
}
tr:nth-last-col(odd)
{
background-color: yellow;
}
</style>
</head>
<body>
<table>
<col span="2">
<col>
<col>
<tr>
<td>odd</td>
<td>odd</td>
<td>odd</td>
<td>odd</td>
</tr>
<tr>
<td colspan="2">odd</td>
<td>odd</td>
<td>odd</td>
</tr>
<tr>
<td>odd</td>
<td colspan="2">odd</td>
<td>odd</td>
</tr>
<tr>
<td>odd</td>
<td>odd</td>
<td colspan="2">odd</td>
</tr>
</table>
</body>
</html>