function check(){
var ddl = document.getElementById("select");
var selectedValue = ddl.options[ddl.selectedIndex].value;
if (selectedValue == "0"){
document.getElementById('select').style.color = 'gray';
}else{
document.getElementById('select').style.color = 'blue';
}
var i;
for (i = 0; i < 3; i++) {
ddl.options[i].style.color = 'blue';
}
ddl.options[0].style.color = 'gray';
}
window.onload = function(){
check();
}
<select id='select' required onchange='check()'>
<option value="0">Default</option>
<option value="1">1</option>
<option value="2">2</option>
</select>
Changing the color of the select onChange. I don't know if you want to do it with pure css only, but I don't see why you can't use javascript.
V2. Quick edit! Made it so that it defaults to blue when <select>
is loaded, as the default option should be colored blue.
V3. Another edit! It also styled the options, so I made it not style the options, just the select!
V4. Minor edit, compacted a lot of the code to make it look better.
V5. Opps. Very silly of me, OP said gray not black. Changed all references of color = 'black'
to color = 'gray'
Final answer. Not making any more edits.