如何删除IE7中链接周围的虚线边框

Mo.*_*Mo. 22 html css css3 internet-explorer-7

点击时有按钮和链接的边框.

在此输入图像描述

在此输入图像描述

任何人都可以帮我解决方案来删除它.

dar*_*rma 49

您可以这样预设:

:focus{
    outline:0; /*removes the dotted border*/
}
Run Code Online (Sandbox Code Playgroud)

但请记住(出于可访问性原因)将CSS文件中的"稍后"样式设置为更明显的样式.例如 :

a:focus, a:active{
    color:#ff5500; /*different color than regular*/
}
input[type=submit]:focus, input[type=submit]:active{
    background-color:#444; /*different color than regular*/
}
Run Code Online (Sandbox Code Playgroud)

  • 是的*确实*工作,请看这里的演示:http://jsfiddle.net/dLVyK/7/我可以知道为什么downvote?这个解决方案非常好. (2认同)
  • @ Abody97 - 是的,这很好,因为我只帮助你.没有理由你不应该投票 (2认同)

小智 14

试试这个吧

a:hover, a:active, a:focus {
  outline: 0;
 }
Run Code Online (Sandbox Code Playgroud)


Kar*_*oos 6

它很难看,但大多数IE修复也是如此.

a:focus, *:focus {
    noFocusLine: expression(this.onFocus=this.blur());
}
Run Code Online (Sandbox Code Playgroud)


Chr*_*ris 6

首先,我可以看到你的一个标签IE7-bug,而这实际上更像是一个功能.这种虚线的目的outline是让用户能够使用鼠标滚轮或tab键在各种控件之间导航.

在任何情况下,要在"聚焦"时定义元素的样式,请使用CSS :focus选择器.这个轮廓的样式属性是,平凡的outline; outline: 0将阻止焦点轮廓出现.

注意:您可能只想在您的按钮上应用该规则,而不是在所有元素上应用该规则,因为某些用户可能习惯于查看指示焦点的内容,这使得使用上述方法更容易导航.

希望以任何方式帮助.

  • @maanu可能是因为你没有定义一个合适的`DOCTYPE`. (2认同)

Voj*_*lka 5

outlineIE7不支持CSS .那个"浏览器"需要以下CSS表达式:

a {
    _noFocusLine: expression(this.hideFocus=true); 
}
Run Code Online (Sandbox Code Playgroud)

它也适用于较新的版本.