[thelist] Style a Disabled Input

James Aylard evolt at pixelwright.com
Wed Oct 29 16:30:52 CST 2003

Hershel Robinson wrote:

>>> apply a class or id and use the appropriate selector.  currently
>>> the only cross browser way of styling specific input types.
>> One of us is confused here. The selector for an input is:
>> input
>> But that CSS selector does NOT override the default behavior of a
>> DISABLED input. That is what I want to do--apply a unique style to
>> DISABLED inputs.

    That was the point of the reply that you received: you must apply a
class to a disabled input that differentiates it from a non-disabled input
in order to style it differently in IE. You would need to do:

<input type="text" name="txtFirst">
<input type="text" name="txtSecond" class="disabled" disabled>

    You would then apply your disabled-specific styling to the class named
"disabled" (or whatever you choose to call it). If you programmatically
change the disabled attribute of an input, you will also need to
programmatically change its class.

James Aylard

More information about the thelist mailing list