开发者

Change background color of disabled selectbox option

开发者 https://www.devze.com 2023-03-20 22:23 出处:网络
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 di

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号