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

a:focus { 
    outline: none; 
}

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

button:focus { 
    outline: none; 
}

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

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


当前回答

你可以尝试在CSS中使用button::-moz-focus-inner {border: 0px solid transparent;}。

其他回答

使用此代码在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 !important;
}

在Firefox中使用CSS无法删除这些点状焦点。

如果你可以访问你的web应用程序工作的计算机,在Firefox中进入about:config并设置browser.display。Focus_ring_width为0。然后Firefox将不会显示任何虚线边界。

下面的错误解释了主题:https://bugzilla.mozilla.org/show_bug.cgi?id=74225

button::-moz-focus-inner { border: 0; }

Where button可以是你想要禁用行为的任何CSS选择器。

下面的CSS代码可以移除这个:

a:focus, a:active, 
button::-moz-focus-inner,
input[type="reset"]::-moz-focus-inner,
input[type="button"]::-moz-focus-inner,
input[type="submit"]::-moz-focus-inner,
select::-moz-focus-inner,
input[type="file"] > input[type="button"]::-moz-focus-inner {
    border: 0;
    outline : 0;
}