To hover the mouse over a row and change the color of the row the style needs to come last in the list of style rules, after the nth-child. If it does not come after the nth child rule it will not apply to any of the rows selected by the nth-child rule. An example would be:

/* Highlight table row on hover */

tr:hover{

  background-color yellow;

}

The shape of the cursor can be changed also to some of the following shapes

Mouse pointers and cursor: property values

This would be added to the hover rule as follows

/* Change color of row when hover and change shape of mouse */

tr:hover{

   /* changes row color */

  background-color yellow;

  /* changes shape of the mouse from I-bar back to arrow when hover over text in table */

  cursor:default;

}

 

Comments (0)

500 characters remaining

Cancel or