How to change the cursor to hand when the mouse goes over a row in the table with CSS?

Spread the love

Sometimes, we want to change the cursor to hand when the mouse goes over a row in the table with CSS.

In this article, we’ll look at how to change the cursor to hand when the mouse goes over a row in the table with CSS.

How to change the cursor to hand when the mouse goes over a row in the table with CSS?

To change the cursor to hand when the mouse goes over a row in the table with CSS, we set the cursor style.

For instance, we write

<table class="sortable" border-style:>
  <tr>
    <th class="tname">Name</th>
    <th class="tage">Age</th>
  </tr>
  <tr>
    <td class="tname">Jennifer</td>
    <td class="tage">24</td>
  </tr>
  <tr>
    <td class="tname">Kate</td>
    <td class="tage">36</td>
  </tr>
  <tr>
    <td class="tname">David</td>
    <td class="tage">25</td>
  </tr>
  <tr>
    <td class="tname">Mark</td>
    <td class="tage">40</td>
  </tr>
</table>

to add a table.

Then we write

.sortable tr {
  cursor: pointer;
}

to select all the tr elements in the table with class sortable.

And we set the row’s cursor to pointer to show the hand as the cursor when we hover through them.

Conclusion

To change the cursor to hand when the mouse goes over a row in the table with CSS, we set the cursor style.

Leave a Reply

Your email address will not be published. Required fields are marked *