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
https://forums.phpfreaks.com/topic/167720-make-a-table-cell-a-link/
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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.