How can entire table cell be hyperlinked in html without javascript or jquery?
I tried to put href in td tag itself but its not working at least in chrome 18
I have also been looking for a solution, and just found this code on another site:
<td style="cursor:pointer" onclick="location.href='mylink.html'">link</td>
I have seen this before when people are trying to build a calendar. You want the cell linked but do not want to mess with anything else inside of it, try this and it might solve your problem.
<tr>
<td onClick="location.href='http://www.stackoverflow.com';">
Cell content goes here
</td>
</tr>
you can give an <a> tag the visual behavior of a table cell:
HTML:
<table>
<tr>
<a href="...">Cell 1</a>
<td>Cell 2</td>
</tr>
</table>
CSS:
tr > a {
display: table-cell;
}
Here is my solution:
<td>
<a href="/yourURL"></a>
<div class="item-container">
<img class="icon" src="/iconURL" />
<p class="name">
SomeText
</p>
</div>
</td>
(LESS)
td {
padding: 1%;
vertical-align: bottom;
position:relative;
a {
height: 100%;
display: block;
position: absolute;
top:0;
bottom:0;
right:0;
left:0;
}
.item-container {
/*...*/
}
}
Like this you can still benefit from some table cell properties like vertical-align
.(Tested on Chrome)