JSFiddle - React, Tailwind, and code Playground

by Rogier

HTML

<table>
	<thead>
		<tr>
			<th>A</th>
		</tr>
	</thead>
	<tbody>
		<tr>
			<td>a</td>
		</tr>
		<tr>
			<td>b</td>
		</tr>
	</tbody>
</table>

<table>
	<thead>
		<tr>
			<th>A</th>
		</tr>
	</thead>
	<tbody>
		<tr>
			<td>a</td>
		</tr>
		<tr>
			<td>b</td>
		</tr>
	</tbody>
	<tfoot>
		<tr>
			<td>c</td>
		</tr>
	</tfoot>
</table>

<table>
	<thead>
		<tr>
			<th>A</th>
		</tr>
	</thead>
	<tfoot>
		<tr>
			<td>a</td>
		</tr>
	</tfoot>
	<tbody>
		<tr>
			<td>b</td>
		</tr>
		<tr>
			<td>c</td>
		</tr>
	</tbody>
</table>

<table>
	<thead>
		<tr>
			<th>A</th>
		</tr>
	</thead>
	<tfoot></tfoot>
	<tbody>
		<tr>
			<td>b</td>
		</tr>
		<tr>
			<td>c</td>
		</tr>
	</tbody>
</table>

CSS

table > :last-child > tr:last-of-type,
table tfoot > tr:last-of-type {
	background-color: #0f0;
}

table > tfoot:not(:empty) ~ :last-child > tr:last-of-type {
	background-color: initial;
}