通过javascript删除或禁用浏览器的焦点边框
有没有人知道如何禁用或操纵(在大多数浏览器中)dom元素的虚线边框,如果它的焦点在tabindex顺序?
我想为聚焦的元素构build自己的样式,但使用现有的function会很好,因为使用tabindex可以将keydown事件绑定到dom元素。
只要为你想要的outline:none;做一个CSS规则outline:none; 
CSS技巧:
 :focus { outline: none; } 
 a { outline: 0; } a: hover, a: active, a: focus { outline: none; } input::-moz-focus-inner { border: 0; } 
使用Firefox 53.0,如果我使用提议的解决scheme之一禁用了大纲,Firefox将显示默认的大纲。
但是,如果使用空白颜色,则不会检测到轮廓是隐藏的:
 input:focus{ outline: 1px solid rgba(255,255,255,1); } 
 input::-moz-focus-inner { border: 0; } 
  :focus state – 设置轮廓属性为0px实心透明; 
使用jQuery,你可以做
 $("#nav li a").focus(function(){ $(this).blur(); });