Is there any way to control table cell to highlight the cell (by changing the background color) when mouseover it?
Currently, I see table-hover but that is impacting the entire row i.e. all the cell's (in that row) background is changing.
Is there any way to control table cell to highlight the cell (by changing the background color) when mouseover it?
Currently, I see table-hover but that is impacting the entire row i.e. all the cell's (in that row) background is changing.
Do not use .table-hover and use the following css.
tr > td:hover {
/* css rules */
}
tr > td:hover {
background-color:red;
color: white;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.0.2/css/bootstrap.min.css" rel="stylesheet"/>
<table class="table table-bordered">
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">First</th>
<th scope="col">Last</th>
<th scope="col">Handle</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">1</th>
<td>Mark</td>
<td>Otto</td>
<td>@mdo</td>
</tr>
<tr>
<th scope="row">2</th>
<td>Jacob</td>
<td>Thornton</td>
<td>@fat</td>
</tr>
<tr>
<th scope="row">3</th>
<td colspan="2">Larry the Bird</td>
<td>@twitter</td>
</tr>
</tbody>
</table>
You may not need to use .table-bordered