Log in

View Full Version : empty div link?



pookeyblow
12-02-2009, 10:13 AM
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:


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


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

jscheuer1
12-02-2009, 10:34 AM
I'm assuming that:


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:


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

pookeyblow
12-02-2009, 10:53 AM
thanks a lot!