Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bootstrap-Select : remove ugly focus border

I know this has been asked for regular html controls, but I cannot seem to get rid of this ugly black border that surrounds my selectpicker list box :

enter image description here

And when I don't have focus:

enter image description here

There's already a focus radius blue color that surrounds my input, so for accessibility, I do not need this black one. I've read everywhere that I need to use outline: none; css, but it isn't working in my case.

This is my CSS:

.customSelect{
  border: 1px solid #ced4da !important;
  color: #495057 !important;
}
.customSelect:hover{
  background-color: #f8f9fa !important;
}
.customSelect:focus{
  outline:none !important;

  /* also tried adding in :
  outline-width: 0 !important;
  box-shadow: none;
  -moz-box-shadow: none;
  -webkit-box-shadow: none;
  */

And my input html:

<select name="function_title_id" 
id="function_title_id"  
title="Please select..."
class="form-control selectpicker" 
data-live-search="true"
data-style="customSelect"
data-dropup-auto="false"
disabled>
</select>

What am I missing ? Thanks!

UPDATE: Here's a fiddle link showing my problem : https://jsfiddle.net/jocxaqe9/

like image 449
Pat Avatar asked Feb 03 '26 16:02

Pat


2 Answers

Bootstrap 5:

Add the class "shadow-none" to remove the shadow.

like image 103
Nagarjun Avatar answered Feb 05 '26 04:02

Nagarjun


This works in 2022 for Bootstrap 5 Removes all focus shadows

*:focus {
    box-shadow: none !important;
}

just make sure this is below the bootstrap css file

like image 31
VIDesignz Avatar answered Feb 05 '26 06:02

VIDesignz



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!