How can a <label> completely fill its parent <td>?

Posted by Shawn on Stack Overflow See other posts from Stack Overflow or by Shawn
Published on 2010-05-15T19:36:55Z Indexed on 2010/05/15 19:44 UTC
Read the original article Hit count: 207

Filed under:

Here is the relevant code (doesn't work):

<html>
<head>
<title>testing td checkboxes</title>
<style type="text/css">
td { border: 1px solid #000; }
label { border: 1px solid #f00; width: 100%; height: 100% }
</style>
</head>
<body>
<table>
<tr><td>Some column title</td><td>Another column title</td></tr>
<tr><td>Value 1<br>(a bit more info)</td><td><label><input type="checkbox" /> &nbsp;</label></td></tr>
<tr><td>Value 2</td><td><input type="checkbox" /></td></tr>
</table>
</body>
</html>

The reason is that I want a click anywhere in the table cell to check/uncheck the checkbox.

© Stack Overflow or respective owner

Related posts about css