Styling disabled <select> in Chrome
Solution 1
It seems to be working just fine using Chrome 15.
input[disabled] {
color: #933;
background-color: #ffc;
}
Make sure you´ve cleared any cached style sheets.
Created a jsFiddle.
UPDATE
Noticed your question title and updated the example.
It´s seems to be a known issue for Chrome in Windows, see Style disabled multiple select – google chrome
Solution 2
The code below is works for me (style the option colors not select box itself):
<select multiple="multiple" disabled="disabled">
<option style="color:#CCCCCC;" value="1" selected>Monday</option>
<option style="color:#CCCCCC;" value="2" selected>Tuesday</option>
<option style="color:#CCCCCC;" value="3">Wednesday</option>
<option style="color:#CCCCCC;" value="4">Thursday</option>
<option style="color:#CCCCCC;" value="5">Friday</option>
<option style="color:#CCCCCC;" value="6">Saturday</option>
<option style="color:#CCCCCC;" value="7">Sunday</option>
</select>
apros
Updated on June 18, 2022Comments
-
apros almost 2 years
For styling disabled elements I used:
[disabled] { /* Text and background colour, medium red on light yellow */ color:#933; background-color:#ffc; }
It's work perfectly in all browsers except Chrome. Is there exists a way to overcome this using css without classes, because I have a huge amount of elements on different pages and don't want to change it all.
Thanks in advance.
UPDATE
After some investigation I have realized that this can be reproduced only if client has a server OS like Windows 2008 and use only Chrome browser. But I hope its a rear condition in real life.
-
apros over 12 yearsThanks, it works perfectly, but it depended on the server OS. On my local Windows 7 it works, but on the server Windows 2008 it doesn't work.
-
Stefan over 12 yearsFor me it works with Windows 7 but not with Windows XP. Did I answer your question? :)
-
apros over 12 yearsYes, I think your answer is the most close to the solution. Thank you very much.
-
apros over 11 yearsThanks Orhun Alp Oral, but it seems not to be a problem for modern versions of Chrome at all.
-
cdonner over 10 yearsThis does not seem to work in IE, but I can set the background color in IE, which also solved my problem.