How to add hyperlink in td background image?

Discussion in 'HTML & Website Design' started by Prateekgupta, Nov 16, 2010.

  1. #1
    Hey guys,
    see this following coding
    There is a image logo2.png
    I want it to add hyperlink to the image .. but i am not able to do it.. plz help me

    <td background="{THEME}/images/logo2.png"></td>
    PHP:
    help me
     
    Prateekgupta, Nov 16, 2010 IP
  2. badhim

    badhim Member

    Messages:
    32
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    28
    #2
    Try this code:

    <td background="{THEME}/images/logo2.png" onclick="window.open('http://...')"></td>
     
    badhim, Nov 16, 2010 IP
  3. jibin

    jibin Peon

    Messages:
    43
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    or try this code:

    <td background="{THEME}/images/logo2.png"><a style="display:block;" href="#">&nsp;</a></td>
    Code (markup):
     
    jibin, Nov 20, 2010 IP
  4. Gediminas

    Gediminas Peon

    Messages:
    37
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Or use location.href instead of window.open, if you want to open in the same window
     
    Gediminas, Nov 21, 2010 IP
  5. barutiwa

    barutiwa Greenhorn

    Messages:
    93
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    16
    #5
    It follows the same idea in a basic html page. That is
    <a href=""><img src=""></a>
    Code (markup):
    Keep it simple stupid (kiss).
     
    barutiwa, Nov 22, 2010 IP
  6. CSM

    CSM Active Member

    Messages:
    1,047
    Likes Received:
    25
    Best Answers:
    0
    Trophy Points:
    55
    #6
    Do not use tables for site layout at all and you won't have problems like that.

    Tables are for data, CSS for layout
     
    CSM, Nov 22, 2010 IP
  7. mushget

    mushget Active Member

    Messages:
    138
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    53
    #7
    First, why are you using tables?
    Rather than putting the logo in as a background image, put the logo image on the page and wrap it in the <a> tags. If you do that, make sure that the image has proper alt text.
     
    mushget, Nov 22, 2010 IP
  8. mahesh2010

    mahesh2010 Guest

    Messages:
    133
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Hi,
    here is the code you can use
    <td ><a href="google.com"><div class="background"></div></a></td>
    .background
    {
    background:url(../images/back.jpg) no-repeat;
    height:220px;
    width:220px;
    }
     
    mahesh2010, Nov 22, 2010 IP