HTML Element Style How to - After hover effect for each cell








Question

We would like to know how to after hover effect for each cell.

Answer


<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
td {<!-- ww w . ja  va2 s . c  o m-->
  border: 1px solid #ccc;
}

table tr>td>label {
  opacity: 0;
}

table tr>td:hover>label {
  opacity: 1;
}
</style>
</head>
<body>
  <table>
    <tr>
      <td>text <label>test</label></td>
      <td>text <label>test</label></td>
    </tr>
  </table>
</body>
</html>

The code above is rendered as follows: