Using Bootstrap 4.6, all my form select dropdowns have a blue background like this:
I have a .scss
file setup similar to this:
// Custom Variables
@import '../../vendor/bootstrap-4.6.0/scss/functions';
@import '../../vendor/bootstrap-4.6.0/scss/variables';
// Bootstrap Overrides
$primary: #6b37c4;
$link-color: $primary;
$link-hover-color: darken($primary, 10%);
$WHAT-GOES-HERE-BG?: $primary; // <-- what goes here?
My question:
Is there a Bootstrap 4.6 variable I could change that would change this blue background color to something else, globally?
If yes, what is the variable name(s)? I tried custom-select-bg
and custom-select-background
, form-select-bg
, and similar.
If not, is there a way to change this blue background for Bootstrap 4.6? I have no understanding of browser compatibility, but obviously would like something long-lasting. I tried several solutions on html - Change select list option background color on hover but many were out-of-date or hacky.
Basic example
I would expect the background color of a select option to turn yellow on hover, but it doesn't. I also don't know how to prevent the select menu from closing to inspect the CSS! Going a little bit crazy.
#mySelectDiv {
max-width: 300px;
padding: 1rem;
}
option:hover {
background-color: yellow;
}
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/css/bootstrap.min.css" integrity="sha384-xOolHFLEh07PJGoPkLv1IbcEPTNtaed2xpHsD9ESMhqIYd0nLMwNLD69Npy4HI+N" crossorigin="anonymous">
<div class="my-3" id="mySelectDiv">
<select class="custom-select" id="myCustomSelect">
<option selected>Open this select menu</option>
<option value="1">One</option>
<option value="2">Two</option>
<option value="3">Three</option>
</select>
</div>
<script src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.1/dist/umd/popper.min.js" integrity="sha384-9/reFTGAW83EW2RDu2S0VKaIzap3H66lZH81PoYlFhbGU+6BZp6G7niu735Sk7lN" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/js/bootstrap.min.js" integrity="sha384-+sLIOodYLS7CIrQpBjl+C7nPvqq+FbNUBDunl/OZv93DB7Ln/533i8e/mZXLi/P+" crossorigin="anonymous"></script>