Jump to content

Make a table cell a link


smerny

Recommended Posts

is there a way to make a whole cell or even a whole row or table a link? the closest think i could do is put a link inside of it with display:block... but what if i want text with different properties within it? or multiple rows of text? or text and images? and still want the entire cell to be linked to a certain page?

 

basically i want this <tr><a href...><td>stuff here</td></a></tr>

 

without javascript if possible

Link to comment
Share on other sites

A whole cell - yes. A whole row - no.

 

You have the right idea on setting the link to be a block, and expanding it to the size of the cell. That will work, and in fact is the only way to do it without using javascript.

 

If you want to have linebreaks and separate styling within the link/cell, you can wrap text in <span> tags, and use <br /> tags.

 

Although really, unless it's tabular data, you shouldn't be using tables anyways. But that's whole different issue.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.