How to remove the border highlight on an input text element

前端 未结 18 986
庸人自扰
庸人自扰 2020-11-22 05:49

When an HTML element is \'focused\' (currently selected/tabbed into), many browsers (at least Safari and Chrome) will put a blue border around it.

For the layout I a

相关标签:
18条回答
  • 2020-11-22 06:34

    Try this:

    *:focus {
        outline: none;
    }
    

    This would affect all your pages.

    0 讨论(0)
  • 2020-11-22 06:35

    The only solutiion that worked with me

    The border is actually a shadow. So to hide it I had to do this:

    input[type="text"]:focus{
         box-shadow: 0 0 0 rgb(255, 255, 255);
    }
    
     input[type="checkbox"]:focus{
          box-shadow: 0 0 0 rgb(255, 255, 255);
     }
    
    0 讨论(0)
  • 2020-11-22 06:39

    Remove the outline when focus is on element, using below CSS property:

    input:focus {
        outline: 0;
    }
    

    This CSS property removes the outline for all input fields on focus or use pseudo class to remove outline of element using below CSS property.

    .className input:focus {
        outline: 0;
    } 
    

    This property removes the outline for selected element.

    0 讨论(0)
  • 2020-11-22 06:41

    You could use CSS to disable that! This is the code I use for disabling the blue border:

    *:focus {
        outline: none;
    }
    

    This is a working example

    0 讨论(0)
  • 2020-11-22 06:42

    I tried all the answers and I still couldn't get mine to work on Mobile, until I found -webkit-tap-highlight-color.

    So, what worked for me is...

    * { -webkit-tap-highlight-color: transparent; }
    
    0 讨论(0)
  • 2020-11-22 06:43

    You can remove the orange or blue border (outline) around text/input boxes by using: outline:none

    input {
        background-color: transparent;
        border: 0px solid;
        height: 20px;
        width: 160px;
        color: #CCC;
        outline:none !important;
    }
    
    0 讨论(0)
提交回复
热议问题