Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I change the font color of a disabled SELECT element? (Works in Firefox but not in IE)

How can I change the font color of a disabled SELECT element in IE? No matter what I tried it stays gray. I was able to change the background from gray to white but the text inside the disabled SELECT stays the same. What works perfectly for Firefox has no effect in terms of font color in IE (in this case IE8). You can see the latest situation for both browsers here:

http://www.flickr.com/photos/64416865@N00/4732813702/

I use jQuery to disable the select element:

$(selectObject).attr('disabled', 'disabled');

and here is the CSS class that I use for disabled selects:

select[disabled] {
    color: black;
    background-color: white;
    border-style: solid;
}

I find it very strange that I could easily change the default background color of disabled selects but not the default font color. Any tips or ideas about this? (Or is this completely impossible in IE by using CSS?)

like image 585
Emre Sevinç Avatar asked Jun 25 '10 10:06

Emre Sevinç


1 Answers

It might be impossible to do in current IEs. Browsers to come will probably support a :disabled pseudo-class (see http://www.w3.org/Style/CSS/Test/CSS3/Selectors/current/html/full/flat/css3-modsel-24.html )

like image 168
Marijn Avatar answered Oct 01 '22 09:10

Marijn