html - How can I make a link from a <td> table cell -


i have following:

<td>   text   <div>a div</div> </td> 

i'd make entire <td>...</td> hyperlink. i'd prefer without use of javascript. possible?

yes, that's possible, albeit not literally <td>, what's in it. simple trick is, make sure content extends borders of cell (it won't include borders though).

as explained, isn't semantically correct. a element inline element , should not used block-level element. however, here's example (but javascript plus td:hover css style neater) works in browsers:

<td>   <a href="http://example.com">     <div style="height:100%;width:100%">       hello world     </div>   </a> </td> 

ps: it's neater change a in block-level element using css explained in solution in thread. won't work in ie6 though, that's no news ;)

alternative (non-advised) solution

if world internet explorer (rare, nowadays), can violate html standard , write this, work expected, highly frowned upon , considered ill-advised (you haven't heard me). other browser ie not render link, show table correctly.

<table>     <tr>         <a href="http://example.com"><td  width="200">hello world</td></a>     </tr> </table> 

Comments

Popular posts from this blog

c++ - How do I get a multi line tooltip in MFC -

asp.net - In javascript how to find the height and width -

c# - DataTable to EnumerableRowCollection -