Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change background color of selected items in "multiselect" dropdown box? [duplicate]

I want to give the yellow color to the selected items in multiselect dropdown box. By default, it has gray background after selecting, How to do this in HTML, CSS.

This question is about multiselect but for single select refer (Related but not duplicate of either): How to apply background-color to a selected option?

like image 670
user9371102 Avatar asked Nov 22 '12 15:11

user9371102


2 Answers

We can simply do with the help of the below CSS:

select option:checked{
  background: #1aab8e -webkit-linear-gradient(bottom, #1aab8e 0%, #1aab8e 100%);
}
like image 97
Vikash Gupta Avatar answered Sep 22 '22 15:09

Vikash Gupta


<style>
     .select2-container--default .select2-results__option[aria-selected=true] {
        background-color: inherit;
        color: lightgray;
    }
</style>

Add your own style inside the block.

like image 40
Elnaz Avatar answered Sep 20 '22 15:09

Elnaz