Results 1 to 3 of 3

Thread: empty div link?

  1. #1
    Join Date
    Nov 2009
    Posts
    43
    Thanks
    14
    Thanked 0 Times in 0 Posts

    Default empty div link?

    I'm having a little problem. I have a div with a background-image and I want to use it as a link.

    my code:
    Code:
    <style type="text/css">			
    #infobox {
    position: fixed;
    left: 30px;
    bottom: 0px;
    width: 60px;
    height: 35px;
    background-image:url(infobox.png);
    background-repeat: no-repeat;
    }
         	  
    #infobox img, #topcontrol img {
    width: 50px!important;
    vertical-align: bottom;
    }
    </style>
    
    <div id="infobox">
    <a href="info.html" rel="shadowbox;height=500;width=700"></a>
    </div>
    I only get it to work when I put some text between the <a> tags like this:
    Code:
    <div id="infobox">
    <a href="info.html" rel="shadowbox;height=500;width=700">now it works (but for this text only)!!</a>
    </div>
    I want the whole div to work as a link so i can get my js code to work properly!

    Does anyone know what I can do to get my div to behave as a link?


    thanks!

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    I'm assuming that:

    Code:
    rel="shadowbox;height=500;width=700"
    is some sort of instruction to the script and not meant as style for the link. If I've got that right, try:

    Code:
    <style type="text/css">	
    
    #infobox {
    position: fixed;
    left: 30px;
    bottom: 0px;
    }
    		
    #infobox, #infobox a {
    width: 60px;
    height: 35px;
    }
    
    #infobox a {
    display: block;
    background-image: url(infobox.png);
    background-repeat: no-repeat;
    }
    
    #infobox img, #topcontrol img {
    width: 50px!important;
    vertical-align: bottom;
    }
    </style>
    
    <div id="infobox">
    <a href="info.html" rel="shadowbox;height=500;width=700"></a>
    </div>
    BTW, in your example code there is no #infobox img element.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. The Following User Says Thank You to jscheuer1 For This Useful Post:

    pookeyblow (12-02-2009)

  4. #3
    Join Date
    Nov 2009
    Posts
    43
    Thanks
    14
    Thanked 0 Times in 0 Posts

    Default

    thanks a lot!

Bookmarks

Posting Permissions

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