I would like to change the background color of odd tr only of .headcol class.
.headcol is a sticky column on left.
thead th {
position: -webkit-sticky; /* for Safari */
position: sticky;
top: 0;
font-family: Poppins-Thin, sans-serif;
}
.headcol {
position: -webkit-sticky; /* for Safari */
position: sticky;
left: 0;
background-color: white;
}
.headcol tr:nth-child(odd) {
background-color: blue;
}
<table class="table" id="TabListing">
<thead class="thead-dark">
<th class="headcol">Nom</th>
<th>Prénom</th>
</thead>
<tbody>
<tr>
<td class="headcol">BAR</td>
<td>Mohamed</td>
</tr>
<tr>
<td class="headcol">BIAI</td>
<td>Ikrame</td>
</tr>
</tbody>
</table>
This code don't give me anything...
If I try :
tr:nth-child(odd) {
background-color: blue;
}
Odd tr are blue but not .headcol