IE7 outline:0 not working

2019-07-03 01:27发布

问题:

I understand the the outline is used for accessibility but what's another way of doing:

a {
   outline: 0;
}

something that works in IE7

using Jquery perhaps?

回答1:

For jquery you can try something like this

$('a').focus(function() {
  $(this).blur();
});

It's essentially the same thing as the IE 7 only solution, it says when anchor is focused, blur it. I tried this on Mac VM IE 7 and it works

http://jsfiddle.net/QnMLR/2/

the top one has the outline and bottom one does not



回答2:

now used to focus

a:hover, a:active, a:focus{
outline:0;
}

more info http://css-tricks.com/removing-the-dotted-outline/


Updated ie solution is

a:focus, *:focus {
    noFocusLine: expression(this.onFocus=this.blur());
}

more info http://www.cssjunction.com/css/remove-dotted-border-in-ie7/



回答3:

This works as well using jquery and doesn't mess up the tab order:

$(function ()
{
    $("a").each(function() {
        $(this).attr("hideFocus", "true").css("outline", "none");
    });
});


回答4:

I think the _noFocusLine do work in IE7

a{
    outline: none;
    _noFocusLine: expression(this.hideFocus=true);
}

I found this from here , and I have tried it by myself. Hope this will help you.