How do I make this entire td a link?
<td id="blue-border"><span id="blue"></span></td>
Clicking td should make it behave like this (I know this is syntactically incorrect:
<a href="javascript:chooseStyle('blue-theme', 360)"> <td id="blue-border"><span id="blue"></span></td> </a>
EDIT: so far all the suggestions are only making the span inside the td a link, help lol.
Using <a> tag inside <td> One more way to make the whole row clickable is to add an <a> inside every <td> element. Along with it add hover to the row which we want to make clickable and use display: block property to anchor to make the whole row clickable.
Use CSS.
td a { display: block; width: 100%; height: 100%; }
<table style="width: 100%">
<tr>
<td><a href="#">Link</a></td>
</tr>
</table>
The CSS forces the link to expand to the full width and height of the TD.
You can't wrap a td in an anchor. Do this:
<td id="blue-border"><a href="javascript:chooseStyle('green-theme', 360)"> <span id="blue"></span></a></td>
Or
<td onclick="chooseStyle('green-theme', 360)" id="blue-border"><span id="blue"></span></td>
Add an anchor tag inside of the td and set its display attribute to block. This should make the entire td clickable.
#blue-border a{
display: block;
}
or
<a href="link" style="display:block;">
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With