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

user9371102 picture user9371102 · Nov 22, 2012 · Viewed 34.4k times · Source

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?

Answer

Vikash Gupta picture Vikash Gupta · Dec 14, 2016

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

select option:checked{
  background: #1aab8e -webkit-linear-gradient(bottom, #1aab8e 0%, #1aab8e 100%);
}