Search code examples
csshyperlinkblockhrefexplorer

Hyperlink block element doesn't work in Internet Explorer


My head is about to explode after looking into why this is not working for me. All is ok in Firefox but in IE nothing shows up to click unless I have text or something in the <a>'s. I've searched for a long time and would prefer not using un-needed .gifs. You can ignore the high z-index values. I've also tried putting <a> in a <span>. Basically what I want is an empty div and empty a that links to an image.

.gallery
{
position:absolute;
width:400px;
height:100px;
margin-left:300px;
margin-top:0px;
z-index:1000000;
}

.gallery a 
{
position:relative;
cursor:pointer;
display:block;
width:400px;
height:100px;
z-index:999999999;
}

<div class=\"gallery\"><a title=\"Front Entrance of the new Pontiac branch.\" href=\"images/Pontiac/P5020002.JPG\"></a></div>

Solution

  • The problem is IE needs a background. You can fool it with a spacer image or just a dummy image like:

    background:url(/no-image.jpg);
    

    That should fix it.