我可以让Firefox不显示丑陋的点状焦点轮廓的链接:

a:focus { 
    outline: none; 
}

但我怎么能这样做<按钮>标签以及?当我这样做的时候:

button:focus { 
    outline: none; 
}

当我点击它们时,按钮仍然有虚线焦点轮廓。

(是的,我知道这是一个可用性问题,但我想提供我自己的重点提示,这是适合于设计,而不是丑陋的灰点)


当前回答

在尝试了以上的许多选择后,只有以下几种对我有用。

*:focus, *:visited, *:active, *:hover  { outline:0 !important;}
*::-moz-focus-inner {border:0;}

其他回答

网络上有很多解决方案,其中很多都是有效的,但为了做到这一点,你可以使用以下方法:

::-moz-focus-inner, :active, :focus {
    outline:none;
    border:0;
    -moz-outline-style: none;
}

这只是增加了一点额外的安全&密封交易!

使用此代码在Firefox 46和Chrome 49上测试。

input:focus, textarea:focus, button:focus {
    outline: none !important;
}

之前(白点可见)

之后(白点看不见)

如果你想只应用在几个输入字段,按钮等。使用更具体的代码。

input[type=text] {
  outline: none !important;
}
button::-moz-focus-inner {
  border: 0;
}

下面的链接为我工作的情况下,想到分享-如果有人感兴趣。

a, a:visited, a:focus, a:active, a:hover{
    outline:0 none !important;
}

干杯!

你可能想要加强注意力,而不是摆脱它。

button::-moz-focus-inner {border: 2px solid transparent;}

button:focus::-moz-focus-inner {border-color: blue}