Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove blue outline of select option in Twitter Bootstrap

I am working on this example and am seeking how to get rid of that blue outline for drop-down select button and the Search inbox inside the drop down menu. See this image:

enter image description here

I already tried:

.btn-default {
    outline: none !important;
    box-shadow: none !important;
    background-color: transparent !important;
    background-image: none !important;
}
input, textarea, select, a { outline: none !important; }
input:focus, textarea:focus, select:focus{ outline: none; } 

but they are not doing the trick.

like image 331
Mona Coder Avatar asked Jun 21 '14 05:06

Mona Coder


2 Answers

Bootstrap form input elements do not use the outline property, but rather recreate it using box-shadow. You were on the right track with what you were doing, but the style that causes this is the following:

.form-control:focus {
    border-color: #66afe9;
    outline: 0;
    -webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(102,175,233,.6);
    box-shadow: inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(102,175,233,.6);
}

You will want to override those styles with your own, setting the box-shadow to none and adjusting the border-color to match your default.

As for the select box, you can use the following style, as was originally mentioned by @kamlesh-kushwaha, to override the bootstrap setting:

.bootstrap-select .btn:focus {
    outline: none !important;
}
like image 140
Blake Mann Avatar answered Oct 10 '22 21:10

Blake Mann


For <select> dropdown, change in bootstrap-select.min line 29:

.bootstrap-select .dropdown-toggle:focus {
    outline: thin dotted #333 !important;
    outline: 5px auto -webkit-focus-ring-color !important;
    outline-offset: -2px;}

to:

.bootstrap-select .dropdown-toggle:focus {
    outline: none!important;
}
like image 32
Sebastian Avatar answered Oct 10 '22 22:10

Sebastian