Styling disabled select (dropdown boxes) in HTML
In Internet Explorer 9, support will be added for the :disabled
pseudo-selector (ref). I don't know whether that will honor the "color" property, but it seems likely.
In older versions of IE, you can adjust the background color (but not the color). Thus:
<style type="text/css">
select[disabled] { background-color: blue; }
</style>
That works in IE 7 and IE 8. You still can't alter the foreground color, but you can change the background color to contrast more strongly with the gray that IE assigns it when it's disabled.
How to style the disabled and selected 'option' of a 'select' in HTML5
I think you need a little javascript:
HTML
<select onchange="highlight(this)">
<option class="invalid" selected="selected" disabled="disabled">Choose best player...</option>
<option>Walter Payton</option>
<option>Jim McMahon</option>
<option>Mike Singletary</option>
<option>Richard Dent</option>
<option>Steve McMichael</option>
<option>Wilber Marshall</option>
</select>
CSS
option.invalid {
background: #eee;
}
option.valid {
background: #ff8;
}
JavaScript
function highlight(field){
field.options[0].className = 'valid';
}
jsFiddle Demo.
Change the 'option' color with the attribute 'disabled'
Try this:
CSS:
select{
color:red;
}
option{
color:black;
}
Related Topics
How to Set Keyframes Name in Less
Grid Layout on <Fieldset>... Bug on Chrome
Why Doesn't My Child Element Inherit Color from Its Parent When Parent Has More Specific Selector
How to Overwrite CSS Variable with Its Own Value
Ie11 Making Background Image Text Blurry
Bottom-Border Hover Transition
CSS Selector for Class Descendant Within a Class
CSS Keyframe Animation CPU Usage Is High, Should It Be This Way
Make an Item Stick to the Bottom Using Flex in React-Native
Different CSS Transition-Delays for Hover and Mouseout
CSS Background-Image Refuses to Display in ASP.NET MVC
Queryselector with Nested Nth-Child in Chrome Doesn't Appear to Work
Twitter Bootstrap - Border Pushing Contents Down
Using Translatey on Thead and Tbody Messes Up Z-Index
Maintain Aspect Ratio of a Div According to Height
Codeigniter - Simple Base_Url Question