absolute positioned anchor tag (with no text) not clickable in IE

前端 未结 6 913
青春惊慌失措
青春惊慌失措 2020-12-07 15:18

I have two anchors positioned absolute on top of an image, the links are clickable in other browsers (Chrome, FF, Safari) but not in IE (tested in 8 & 9 so far)

6条回答
  •  旧巷少年郎
    2020-12-07 16:13

    I have had this exact problem before and it has always annoyed the hell out of me. I'm never sure why it happens, but I always create a 1px by 1px transparent PNG (or GIF) and use that in your background declaration like so:

    a { background: url("/path/to/image.png") 0 0 repeat; }
    

    Hope this helps.

    PS - Don't specify any actual background colour with this. Just use the example above and it should work.

    In addition to this, try and set your anchor tags to display as block and perhaps also insert a non-breaking space in them (since they are empty at the moment and that might be tripping IE up):

    a { display: block; background: url("/path/to/image.png") 0 0 repeat; }
    
     
    

提交回复
热议问题