Go Back   CodingForums.com > :: Client side development > HTML & CSS

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 08-17-2005, 04:02 PM   PM User | #1
m_baggley
New Coder

 
Join Date: Feb 2005
Posts: 33
Thanks: 0
Thanked 0 Times in 0 Posts
m_baggley is an unknown quantity at this point
Can you hyperlink a td.......

....rather than text or an image?

Anyone know if this is even possible? Please let me know if so

Cheers

Matt
m_baggley is offline   Reply With Quote
Old 08-17-2005, 04:07 PM   PM User | #2
Pennimus
Senior Coder

 
Join Date: Jul 2005
Location: UK
Posts: 1,051
Thanks: 6
Thanked 13 Times in 13 Posts
Pennimus is on a distinguished road
Not technically.

But you can hyperlink text or an image (perhaps invisible?) inside a td and use CSS to count the entire cell as a link.
Pennimus is offline   Reply With Quote
Old 08-17-2005, 04:20 PM   PM User | #3
m_baggley
New Coder

 
Join Date: Feb 2005
Posts: 33
Thanks: 0
Thanked 0 Times in 0 Posts
m_baggley is an unknown quantity at this point
thanks, however

there is text in the Td, but I didn't want to hyperlink the text, but the whole td. Hmm not sure what to do.........
m_baggley is offline   Reply With Quote
Old 08-17-2005, 05:01 PM   PM User | #4
mrruben5
Regular Coder

 
Join Date: Nov 2004
Location: The Netherlands
Posts: 551
Thanks: 0
Thanked 0 Times in 0 Posts
mrruben5 is an unknown quantity at this point
Code:
<td onclick="window.location='http://www.google.com'">Google</td>
I must stress though this is not search engine friendly. You could style the link as a "block" with "display:block;"
__________________
CATdude about IE6: "All your box-model are belong to us"

Last edited by mrruben5; 08-17-2005 at 05:04 PM..
mrruben5 is offline   Reply With Quote
Old 08-17-2005, 05:07 PM   PM User | #5
m_baggley
New Coder

 
Join Date: Feb 2005
Posts: 33
Thanks: 0
Thanked 0 Times in 0 Posts
m_baggley is an unknown quantity at this point
that works....

...thank you very much. Theres no issue with search engines as it is an internal website only. What do you mean by block?
m_baggley is offline   Reply With Quote
Old 08-17-2005, 05:32 PM   PM User | #6
Pennimus
Senior Coder

 
Join Date: Jul 2005
Location: UK
Posts: 1,051
Thanks: 6
Thanked 13 Times in 13 Posts
Pennimus is on a distinguished road
Thats what I meant about using CSS. It effectively turns the whole cell into a link.

HTML -

Code:
<td class="nav">
<a href="whatever.php">Clean Rooms</a>
</td>

Stylesheet -

Code:
.nav a {
	display: block;
 	}
... and whatever other styles you want.

I use this a lot to have the whole cell background colour change when the cell is mouseovered.
Pennimus is offline   Reply With Quote
Old 08-18-2005, 09:38 AM   PM User | #7
Ultragames
Regular Coder

 
Join Date: Aug 2002
Location: Oregon, United States of America
Posts: 882
Thanks: 1
Thanked 9 Times in 9 Posts
Ultragames has a little shameless behaviour in the past
If you style the text with no decoration, and standard coloring, and block the link, the text will look the same, yet the whole <td> will be the link.
__________________
If I'm postin here, I NEED YOUR HELP!!
Ultragames is offline   Reply With Quote
Old 08-18-2005, 04:05 PM   PM User | #8
m_baggley
New Coder

 
Join Date: Feb 2005
Posts: 33
Thanks: 0
Thanked 0 Times in 0 Posts
m_baggley is an unknown quantity at this point
Nice one guys

thank you all for your assistance.

Matt
m_baggley is offline   Reply With Quote
Old 08-18-2005, 04:22 PM   PM User | #9
Bill Posters
Senior Coder

 
Join Date: Feb 2003
Posts: 1,665
Thanks: 0
Thanked 27 Times in 25 Posts
Bill Posters will become famous soon enough
Quote:
Originally Posted by Pennimus
Code:
.nav a {
display: block;
 }
If the table cell is taller than the text you'll need to specifically set the height (or top/bottom padding) to make sure that the anchor area expands to fill the cell vertically too.

e.g.
Code:
.nav a {
display: block;
height: 100%;
}
Just a heads up.

Last edited by Bill Posters; 08-18-2005 at 04:25 PM..
Bill Posters is offline   Reply With Quote
Old 08-19-2005, 10:06 AM   PM User | #10
Pennimus
Senior Coder

 
Join Date: Jul 2005
Location: UK
Posts: 1,051
Thanks: 6
Thanked 13 Times in 13 Posts
Pennimus is on a distinguished road
And the width, presumably...
Pennimus is offline   Reply With Quote
Old 08-19-2005, 10:13 AM   PM User | #11
mrruben5
Regular Coder

 
Join Date: Nov 2004
Location: The Netherlands
Posts: 551
Thanks: 0
Thanked 0 Times in 0 Posts
mrruben5 is an unknown quantity at this point
No you don't have to do that. Elements with display:block as style automaticly fill the entire width, such as a div.
__________________
CATdude about IE6: "All your box-model are belong to us"
mrruben5 is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 02:41 AM.


Advertisement
Log in to turn off these ads.