This might be a duplicate. However it is not duplicate of How to style a <select>
dropdown with CSS only. That thread deals with styling <select>
element. What I am trying to style is the different states of the <option>
inside the <select>
element.
It might be a similar question to CSS :selected pseudo class similar to :checked, but for <select>
elements. Which I have read and benefited from.
I have been reading about it for 2 days, and I came across several different/conflicting answers. Some say it cannot be done, others say some new browsers do support it. So here it goes.
I am unable to change the selected Item's text color of a multi-select dropdown. (blackish in this case)
I am however able to change the background of the selected and unselected items, and I am able to change the color of the unselected item's text. (red)
Also I am unable to change the highlighted items' text color (white in this case) as well.
select.multplClass option:checked {
margin:2px 0 !important;
padding:3px 0 0 40px !important;
background: url("../images/checkbox-02-Thin-24_checked.png") 5px center no-repeat , linear-gradient(#b9e763, #b9e763);
color:blue !important;
}
select.multplClass option:not(:checked) {
margin:2px 0 !important;
padding:3px 0 0 40px !important;
background: url("../images/checkbox-02-Thin-24_unchecked.png") 5px center no-repeat;
color:red !important;
}
<select multiple="" name="staff_type_idx" class="multplClass">
<option class="multiple" value="1" selected="selected">Yönetici</option>
<option class="multiple" value="2">Antrenör</option>
<option class="multiple" value="3" selected="selected">Kondüsyoner</option>
</select>