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

前端 未结 25 1114
耶瑟儿~
耶瑟儿~ 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:15

    If you prefer to use CSS to get rid of the dotted outline:

    /*for FireFox*/
        input[type="submit"]::-moz-focus-inner, input[type="button"]::-moz-focus-inner
        {   
            border : 0;
        } 
    /*for IE8 and below */
        input[type="submit"]:focus, input[type="button"]:focus
        {     
            outline : none; 
        }
    
    0 讨论(0)
  • 2020-11-22 15:16

    You can try button::-moz-focus-inner {border: 0px solid transparent;} in your CSS.

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

    I think you should really know what you're doing by removing the focus outline, because it can mess it up for keyboard navigation and accessibility.

    If you need to take it out because of a design issue, add a :focus state to the button that replaces this with some other visual cue, like, changing the border to a brighter color or something like that.

    Sometimes I feel the need to take that annoying outline out, but I always prepare an alternate focus visual cue.

    And never use the blur() js function. Use the ::-moz-focus-inner pseudo class.

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

    It looks like the only way to achieve this is by setting

    browser.display.focus_ring_width = 0
    

    in about:config on a per browser basis.

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

    The below worked for me in case of LINKS, thought of sharing - in case someone is interested.

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

    Cheers!

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

    The CSS code below works to remove this:

    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;
    }
    
    0 讨论(0)
提交回复
热议问题