How to remove Firefox's dotted outline on BUTTONS as well as links?

前端 未结 25 1110
耶瑟儿~
耶瑟儿~ 2020-11-22 14:23

I can make Firefox not display the ugly dotted focus outlines on links with this:

a:focus { 
    outline: none         


        
相关标签:
25条回答
  • 2020-11-22 15:03

    Tested on Firefox 46 and Chrome 49 using this code.

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

    Before (white dots are visible )

    After ( White dots are invisible )

    If you want to apply only on few input fields, buttons etc. Use the more specific code.

    input[type=text] {
      outline: none !important;
    }
    

    Happy Coding!!

    0 讨论(0)
  • 2020-11-22 15:04

    Along with Bootstrap 3 I used this code. The second set of rules just undo what bootstrap does for focus/active buttons:

    button::-moz-focus-inner {
      border: 0;    /*removes dotted lines around buttons*/
    }
    
    .btn.active.focus, .btn.active:focus, .btn.focus, .btn.focus:active, .btn:active:focus, .btn:focus{
      outline:0;
    }
    

    NOTE that your custom css file should come after Bootstrap css file in your html code to override it.

    0 讨论(0)
  • 2020-11-22 15:05

    You might want to intensify the focus rather than get rid of it.

    button::-moz-focus-inner {border: 2px solid transparent;}
    
    button:focus::-moz-focus-inner {border-color: blue} 
    
    0 讨论(0)
  • 2020-11-22 15:08

    Tried most of the answers here, but none of them worked for me. When I realized that I have to get rid of the blue outline on buttons on Chrome too, I found another solution. Remove blue border from css custom-styled button in Chrome

    This code worked for me on Firefox version 30 on Windows 7. Perhaps it might help somebody else out there :)

    button:focus {outline:0 !important;}
    
    0 讨论(0)
  • 2020-11-22 15:08

    Remove dotted outline from links, button and input element.

    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 {
        border: 0;
        outline : 0;
    }
    
    0 讨论(0)
  • 2020-11-22 15:09

    There's no way to remove these dotted focus in Firefox using CSS.

    If you have access to the computers where your webapplication works, go to about:config in Firefox and set browser.display.focus_ring_width to 0. Then Firefox won't show any dotted borders at all.

    The following bug explains the topic: https://bugzilla.mozilla.org/show_bug.cgi?id=74225

    0 讨论(0)
提交回复
热议问题