How come I can't remove the blue textarea border in Twitter Bootstrap?

后端 未结 18 1102
一向
一向 2020-12-07 11:02

In Chrome, there is a blue border around the textarea.

How come I can\'t remove it?

textarea:hover, input:hover, textarea:active, input:active, texta         


        
相关标签:
18条回答
  • 2020-12-07 11:36

    Bootstrap 3

    If you just want to change the color, change the variable (recommended):

    Less or Customizer

    @input-border-focus: red;
    

    variables.less

    Sass

    $input-border-focus: red;
    

    variables.sass

    If you wan't to remove it completely, you'll have to overwrite the Mixin that sets the outline.

    .form-control-focus(@color: @input-border-focus) {}
    

    CSS

    If you are using css overwrite it via:

    .form-control:focus{
        border-color: #cccccc;
        -webkit-box-shadow: none;
        box-shadow: none;
    }
    

    Link to implementation

    0 讨论(0)
  • 2020-12-07 11:36

    This is what worked for me.. All the other solutions didn't quite work for me, but I understood one thing from the other solutions and its that default styles of textarea and label in combination is responsible for the blue border.

    textarea, label
    {
        outline:0px !important;
    
        -webkit-box-shadow: none !important;
    }
    

    EDIT: I had this issue with Ant Design textarea. Thats why this solution worked for me. So, if you are using Ant, then use this.

    0 讨论(0)
  • 2020-12-07 11:37

    Work out computed styles via an inspector

    For future reference you can work out computed styles via an inspector

    0 讨论(0)
  • 2020-12-07 11:39

    try this, I think this will help and your blue border will be removed:

    outline:none;
    
    0 讨论(0)
  • 2020-12-07 11:40

    For anyone still searching. It's neither border or box-shadow. It's actually "outline". So just set outline: none; to disable it.

    0 讨论(0)
  • 2020-12-07 11:42

    I believe that's a shadow. Try this:

    .box-shadow(none);
    

    Or if you're not using LESS:

    box-shadow: none;
    -moz-box-shadow: none;
    -webkit-box-shadow: none;
    
    0 讨论(0)
提交回复
热议问题