Link bg image in TD

Discussion in 'CSS' started by mariner7, Feb 2, 2009.

  1. #1
    Hi,

    This is driving me nuts -- I'm trying to simply link the bg image to a website:

    <tr>
    <td background="bg.jpg" border="0" style="background-repeat:no-repeat;"><table width="690" border="0" align="center" cellpadding="0"></a>
    </tr>

    I have text with hyper links over the bg image, but I also need the bg image linked if possible.

    Thanks
     
    mariner7, Feb 2, 2009 IP
  2. eric.r

    eric.r Peon

    Messages:
    124
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Where is the beginning of that <a tag??? Either post more code or give a link.

    ~eric
     
    eric.r, Feb 3, 2009 IP
  3. mariner7

    mariner7 Peon

    Messages:
    49
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks for your help with this. Here is the code from the page:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml"
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title></title>

    <meta name="title" content="">
    <link href="style.css" rel="stylesheet" type="text/css" />

    </head>

    <body bgcolor="#CCCCCC" link="#006697 VLINK="#0099E2" ALINK="#006697" "topmargin="0">
    <table width="700" height="100%" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr>
    <td width="1042" bgcolor="#ffffff"><div align="center">
    <table width="700" border="0" cellspacing="0" cellpadding="0">
    <tr>
    <td width="50%"><table width="100%" border="0" cellspacing="0" cellpadding="0">

    </table></td>
    </tr>




    <tr>
    <td background="bg.jpg" border="0" style="background-repeat:no-repeat;"><table width="690" border="0" align="center" cellpadding="0"></a>

    </tr>






    <tr>
    <td align="center" valign="top"><div align="center">
    <table width="885" border="0" cellspacing="0" cellpadding="0">

    <tr>
    <td height="450" align="left" valign="top">
    <p class="body">




    <div id="rightcol" class="body"><table border="0" cellspacing="20" cellpadding="0"><tr><td valign="bottom" height="290"><p><td>

    Our wedding coverage includes the pre-wedding preparations, formal photographs and all-day procedures so we will be there to capture every moment. Our photographic style is natural and candid but unobtrusive so most of the time you won't even know we're there. With our unsurpassed attention to detail, we will create exquisite images reflecting the emotion and the romantic setting of your special day.

    <br><br>



    </tr>
    </table>
    </div></td>
    </tr>
    </table>

    &nbsp;&nbsp;&nbsp;
    <p align="center" class="body">

    </body>
    </html>
     
    mariner7, Feb 3, 2009 IP
  4. KatieK

    KatieK Active Member

    Messages:
    116
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    58
    #4
    Your HTML:

    <tr>
    <td background="bg.jpg" border="0" style="background-repeat:no-repeat;"><table width="690" border="0" align="center" cellpadding="0"></a>
    
    </tr>
    Code (markup):
    is all messed up:
    * You've opened a table that doesn't contain any trs or tds, and also doesn't close.
    * Also, there is no opening anchor (
    <a href="something">
    Code (markup):
    ) anywhere - as eric.r said.

    Here's the deal: You can't link a background image. You can link a content image (
    <a href="something"><img src="image.gif" /></a>
    Code (markup):
    ), and you can link text (
    <a href="something">the text</a>
    Code (markup):
    ) and you can (probably) link a table. If you want to link that table, you're going to need to structure it correctly and populate it with content.

    You can also link any content that happens to be over a background image; often padding an element can provide the illusion of a linked bg image.
     
    KatieK, Feb 3, 2009 IP
    eric.r likes this.