How to make an empty anchor tag clickable in IE7?

前端 未结 4 2049
情书的邮戳
情书的邮戳 2020-12-13 15:44

I need to make an area within a background image clickable to generate an event for JavaScript use. So, I created an anchor tag and inside that I inserted some relevant text

4条回答
  •  情深已故
    2020-12-13 16:23

    Get rid of the semantically meaningless tags and use normal CSS image replacement, instead.

    foo
    

    And then the CSS:

    a { 
        width:100px; 
        height:100px; 
        display:block; 
        text-indent:-9999px; 
        background:url(/img.png) no-repeat;
    }
    

    Add whatever positioning you need, and it should work just fine.

提交回复
热议问题