How to remove dotted border around active hyperlinks in IE8 with CSS

前端 未结 12 1635
囚心锁ツ
囚心锁ツ 2020-11-28 06:31

Active hyperlink texts are highlighted with dotted border. When using effects on such hyperlinks (fadeIn/fadeOut) it produces strange effects. How do I disable/remove the do

12条回答
  •  失恋的感觉
    2020-11-28 07:01

    Typical and safe way to do it is this:

    a:active, a:focus {
       outline:  none; /* non-IE */
       ie-dummy: expression(this.hideFocus=true); /* IE6-7 */
    }
    

    Since expresssion() has been gutted in IE8, you may need a script:

    if (document.documentElement.attachEvent)
        document.documentElement.attachEvent('onmousedown',function(){
             event.srcElement.hideFocus=true
        });
    

    If you're going to remove the default focus outline, you must define your own distinct style for :focus, otherwise keyboard users will have a hard time using your site.

提交回复
热议问题