I have a select
box and I'm trying to change the background color of the options when the select
box has been clicked and shows all the options.
HTML:
<select>
<option val="">Please choose</option>
<option val="1">Option 1</option>
<option val="2">Option 2</option>
<option val="3">Option 3</option>
<option val="4">Option 4</option>
</select>
CSS:
select{
margin:40px;
background: rgba(0,0,0,0.3);
color:#fff;
text-shadow:0 1px 0 rgba(0,0,0,0.4);
}
Best Answer
You need to put
background-color
on theoption
tag and not theselect
tag...If you want to style each one of the
option
tags.. use the cssattribute
selector: