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

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

    This works on firefox v-27.0

     .buttonClassName:focus {
      outline:none;
    }
    
    0 讨论(0)
  • 2020-11-22 15:09

    After trying many options from the above only the following worked for me.

    *:focus, *:visited, *:active, *:hover  { outline:0 !important;}
    *::-moz-focus-inner {border:0;}
    
    0 讨论(0)
  • 2020-11-22 15:11

    [Update] This solution doesn't work anymore. The solution that worked for me is this one https://stackoverflow.com/a/3844452/925560

    The answer marked as correct didn't work with Firefox 24.0.

    To remove Firefox's dotted outline on buttons and anchor tags I added the code below:

    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;
    }
    

    I found the solution here: http://aghoshb.com/articles/css-how-to-remove-firefoxs-dotted-outline-on-buttons-and-anchor-tags.html

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

    If you have a border on a button and want to hide the dotted outline in Firefox without removing the border (and hence it's extra width on the button) you can use:

    .button::-moz-focus-inner {
        border-color: transparent;
    }
    
    0 讨论(0)
  • 2020-11-22 15:14

    This will get the range control:

    :focus {
        outline:none;
    }
    ::-moz-focus-inner {
        border:0;
    }
    input[type=range]::-moz-focus-outer {
        border: 0;
    }
    

    From: Remove dotted outline from range input element in Firefox

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

    Simply add this css for select box

    select:-moz-focusring {
        color: transparent;
        text-shadow: 0 0 0 #000;
    }
    

    This is working fine for me.

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