HTML Element Style How to - Create Clickable Table cell








Question

We would like to know how to create Clickable Table cell.

Answer


<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
td {<!--from w ww . jav a2s  .c  o m-->
  padding: 0;
}

a {
  height: 100%;
  width: 100%;
  display: block;
  border: 5px solid black;
}
</style>
</head>
<body>
  <table>
    <tr>
      <td><a href="#">foo</a></td>
      <td><a href="#">bar</a></td>
    </tr>
  </table>
</body>
</html>

The code above is rendered as follows: