Remove blue border from css custom-styled button in Chrome

前端 未结 22 931
闹比i
闹比i 2020-11-22 17:10

I\'m working on a web page, and I want custom-styled

相关标签:
22条回答
  • 2020-11-22 17:12

    Add this in your CSS file.

    *{
      -webkit-tap-highlight-color: rgba(0, 0, 0, 0) !important;
    }
    
    0 讨论(0)
  • 2020-11-22 17:12

    For anyone using Bootstrap and having this problem, they use :active:focus as well as just :active and :focus so you'll need:

    element:active:focus {
        outline: 0;
    }
    

    Hopefully saved someone some time figuring that one out, banged my head for bit wondering why such a simple thing wasn't working.

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

    I just remove the outline from all the tags in the page by selecting all and applying outline:none to everything:)

    *:focus {outline:none}
    

    As bagofcole mentioned, you might need to add !important as well, so the style will look like this:

    *:focus {outline:none !important}
    
    0 讨论(0)
  • 2020-11-22 17:19

    If you want to delete same effect in input, you could add the following code as well as button.

    input:focus {outline:0;}
    
    0 讨论(0)
  • 2020-11-22 17:20

    Use either this:

    :active {
        outline:none;
    }
    

    or this if that doesn't work:

    :active {
       outline:none !important;
    }
    

    This works for me (FF and Chrome, at least). Instead of targeting the :focus state, just target the :active state and that will remove the aesthetically obtrusive highlighting in your browser when a user clicks a link. But it will still retain the focus states when a user with disabilities tabs or shift-tabs through a page. Both parties are happy. :)

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

    for this problem:

    use this:

       *{
             -webkit-tap-highlight-color: rgba(0,0,0,0);
             -webkit-tap-highlight-color: transparent; /* For some Androids */
        }
    

    result:

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