I have a select element which has several items. I want to change the color of its first item, but it seems the color only shows
when you click on the select dropdown. What I want is to change the color (like gray) when the page is loaded so users can see the first option color is different.
See the example here...
http://jsbin.com/acucan/4/
css:
select{
width: 150px;
height: 30px;
padding: 5px;
color: green;
}
select option { color: black; }
select option:first-child{
color: green;
}
html:
<select>
<option>Item1</option>
<option>Item2</option>
<option>Item3</option>
</select>
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…