Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 11 of 11
  1. #1
    New Coder
    Join Date
    Feb 2005
    Posts
    33
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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

  • #2
    Senior Coder
    Join Date
    Jul 2005
    Location
    UK
    Posts
    1,051
    Thanks
    6
    Thanked 13 Times in 13 Posts
    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.

  • #3
    New Coder
    Join Date
    Feb 2005
    Posts
    33
    Thanks
    0
    Thanked 0 Times in 0 Posts

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

  • #4
    Regular Coder
    Join Date
    Nov 2004
    Location
    The Netherlands
    Posts
    551
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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;"
    Last edited by mrruben5; 08-17-2005 at 05:04 PM.
    CATdude about IE6: "All your box-model are belong to us"

  • #5
    New Coder
    Join Date
    Feb 2005
    Posts
    33
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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?

  • #6
    Senior Coder
    Join Date
    Jul 2005
    Location
    UK
    Posts
    1,051
    Thanks
    6
    Thanked 13 Times in 13 Posts
    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.

  • #7
    Regular Coder
    Join Date
    Aug 2002
    Location
    Oregon, United States of America
    Posts
    882
    Thanks
    1
    Thanked 9 Times in 9 Posts
    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!!

  • #8
    New Coder
    Join Date
    Feb 2005
    Posts
    33
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Nice one guys

    thank you all for your assistance.

    Matt

  • #9
    Senior Coder
    Join Date
    Feb 2003
    Posts
    1,665
    Thanks
    0
    Thanked 27 Times in 25 Posts
    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.

  • #10
    Senior Coder
    Join Date
    Jul 2005
    Location
    UK
    Posts
    1,051
    Thanks
    6
    Thanked 13 Times in 13 Posts
    And the width, presumably...

  • #11
    Regular Coder
    Join Date
    Nov 2004
    Location
    The Netherlands
    Posts
    551
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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"


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •