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

前端 未结 25 1111
耶瑟儿~
耶瑟儿~ 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:22
    button::-moz-focus-inner {
      border: 0;
    }
    
    0 讨论(0)
  • 2020-11-22 15:23
    button::-moz-focus-inner { border: 0; }
    

    Where button can be whatever CSS selector for which you want to disable the behavior.

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

    There is many solutions found on the web for this, many of which work, but to force this, so that absolutely nothing can highlight/focus once a use the following:

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

    This just adds that little bit extra security & seals the deal!

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

    Yep don't miss !important

    button::-moz-focus-inner {
     border: 0 !important;
    }
    
    0 讨论(0)
  • 2020-11-22 15:25

    In most cases without adding the !important to the CSS code, it won't work.

    So, do not forget to add !important

    a, a:active, a:focus{
        outline: none !important; /* Works in Firefox, Chrome, IE8 and above */
    }
    


    Or any other code:

    button::-moz-focus-inner {
      border: 0 !important;
    }
    
    0 讨论(0)
  • 2020-11-22 15:27
    :focus, :active {
        outline: 0;
        border: 0;
    }
    
    0 讨论(0)
提交回复
热议问题