开发者

Overriding disabled input and textarea with CSS

开发者 https://www.devze.com 2022-12-25 02:38 出处:网络
Im trying to override the grey text of a disabled input and textarea. At the moment Im only really concerned with it working in Webkit and Mozilla. At the moment Im currently using every trick in the

Im trying to override the grey text of a disabled input and textarea. At the moment Im only really concerned with it working in Webkit and Mozilla. At the moment Im currently using every trick in the book that I know of:

input[@disabled=true], input[@disabled],
button[disabled]:active, button[disabled],
input[type="reset"][disabled]:active,
input[type="reset"][disabled],
input[type="button"][disabled]:active,
input[type="button"][disabled],
select[disabled] > 开发者_开发技巧input[type="button"],
select[disabled] > input[type="button"]:active,
input[type="submit"][disabled]:active,
input[type="submit"][disabled],input[disabled="disabled"], input[disabled] {
    color: black !important;
}

Sure it does change the colour if I change it to something else, however when I choose black it is still greyed out a bit.

Any ideas? I am using Ext JS if I can use that to manipulate it. Thanks.


input.button-control[disabled]

{

    color: #cccccc !important;

    }

Here button-control is a class on the input element, whose text is overriden to grey when the disabled attribute is set.

I hope this helps.


I would prefer to go the JavaScript way to achieve best browser compatibility. I would use the ExtJS [http://www.extjs.com/deploy/ext-1.1.1/docs/output/Ext.DomQuery.html][DomQuery] and insert the CSS rules by adding specific class or directly injecting them as style attribute values.

0

精彩评论

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

关注公众号