How can I change the color of the top and bottom border of a tr
when hovering over it? The issue I am facing is that the hover styles are being overridden by the tr
above it.
In my example below, only the bottom border is highlighting on the second and third items:
table {
border-collapse: collapse;
}
th {
background-color: rgb(231, 231, 231);
}
td {
border-bottom: 2px solid rgb(214, 214, 214);
border-top: 2px solid rgb(214, 214, 214);
}
table tr:hover td {
border-bottom: 2px solid red;
border-top: 2px solid red;
}
<table>
<tr>
<th>COMPANY</th>
<th>CONTACT</th>
<th>COUNTRY</th>
</tr>
<tr>
<td>Alfreds Futterkiste</td>
<td>Maria Anders</td>
<td>Germany</td>
</tr>
<tr>
<td>Alfreds Futterkiste</td>
<td>Maria Anders</td>
<td>Germany</td>
</tr>
<tr>
<td>Alfreds Futterkiste</td>
<td>Maria Anders</td>
<td>Germany</td>
</tr>
</table>