Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to make a cell of table hyperlink

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

<td href='http://www.m-w.com/dictionary/' style="cursor:pointer"> 
like image 305
vaichidrewar Avatar asked Apr 09 '12 07:04

vaichidrewar


People also ask

Can you insert hyperlinks inside table cells?

Yes in spite of text we just have to insert the anchor tag between the and tags.

How do you make a whole row in a table clickable as a link?

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.

Can a table row be a link?

Allowing a table row to be a link is not as simple as one might think. This article explains what the main issue is with making links out of table rows, provides some solutions to the problem, showcase some real-world examples, and question whether having a table row as a link is something that should even be done.


2 Answers

Try this:

HTML:

<table width="200" border="1" class="table">     <tr>         <td><a href="#">&nbsp;</a></td>         <td>&nbsp;</td>         <td>&nbsp;</td>     </tr> </table> 

CSS:

.table a {     display:block;     text-decoration:none; } 

I hope it will work fine.

like image 95
Kamal Avatar answered Sep 18 '22 17:09

Kamal


Try this way:

<td><a href="..." style="display:block;">&nbsp;</a></td> 
like image 38
azawaza Avatar answered Sep 19 '22 17:09

azawaza