htmlcssui-select2

Can't remove hover color in combobox


I am making the select2 combo box, I want to remove blue color hover style, but I cannot remove it, does not exit. How can I do it? Please give me a solution, thanks EXAMPLE

Js

jQuery(document).ready(function($){
    $('select').select2({width:100});
    $('b[role="presentation"]').hide();
    $('.select2-selection__arrow').append('<i class="fa fa-angle-down"></i>');
});

view

<select class="js-example-basic-single">
  <option value="AL">Alabama</option>
  <option value="WY">Wyoming</option>
</select>

CSS

.select2-dropdown.select2-dropdown--below{
      width: 148px !important;
}

.select2-container--default .select2-selection--single{
    padding:6px;
    height: 37px;
    width: 148px; 
    font-size: 1.2em;  
    position: relative;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    background-image: -khtml-gradient(linear, left top, left bottom, from(#424242), to(#030303));
    background-image: -moz-linear-gradient(top, #424242, #030303);
    background-image: -ms-linear-gradient(top, #424242, #030303);
    background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #424242), color-stop(100%, #030303));
    background-image: -webkit-linear-gradient(top, #424242, #030303);
    background-image: -o-linear-gradient(top, #424242, #030303);
    background-image: linear-gradient(#424242, #030303);
    width: 40px;
    color: #fff;
    font-size: 1.3em;
    padding: 4px 12px;
      height: 27px;
  position: absolute;
  top: 0px;
  right: 0px;
  width: 20px;
}

Solution

  • Add the following to your CSS code since the code causing the blue hover effect is in a minified css file and is hard to edit:

    .select2-container--default .select2-results__option--highlighted[aria-selected] {
        background-color: lightgreen !important;
        color: white;
    }
    .select2-container--default .select2-results__option[aria-selected=true] {
        background-color: inherit;
    }
    

    Here is your updated JSFiddle