How do you make a whole div into a link?

You can't put 'a' tags around a div, but you can do this with javascript :

HTML
<div onclick="javascript:location='http://bonrouge.com'" id="mydiv">
... stuff goes here ...
</div>
If you want to use an empty div with a background image as a link instead of putting your image into the html, you can do something like this:
CSS
#empty {
background-image:url(wine.jpg);
width:50px;
height:50px;
margin:auto;
}
#empty a {
display:block;
height:50px;
}
* html #empty a {
display:inline-block;
}
HTML
<div id="empty"><a href="#n"></a></div>

0 comments: