Change background color of disabled selectbox option
Is it possible to change the background color of disabled option in a selectbox in HTML ?
I have 2 disabled item to split the choice in my box and would like to put a color in 开发者_JAVA技巧those disabled option to separate them.
Thanks
have you tried input[disabled]
as a css selector or input:disabled
. Unfortunately I don't think there's a way to do this is IE without javascript.
Locrizak is right,
input[disabled]
it is called attribute selector, and you can easily style it in CSS. If you want to be consistent with the results you can find here a good guide.
The problem comes if you use IE6, because attribute selectors are not supported (Reference)
If you want to be sure that the result is cross-browser compatible, just add a new class to your element.
<input type="button" class="disabled"/>
this will work in IE6 as well.
精彩评论