CSS3 :disabled Selector


Example

Set a background color for all disabled input elements of type="text":

input[type="text"]:disabled {
    background: #dddddd;
}

Try it yourself »

More "Try it Yourself" examples below.


Definition and Usage

The :disabled selector matches every disabled element (mostly used on form elements).

Version: CSS3


Browser Support

The numbers in the table specifies the first browser version that fully supports the selector.

Selector
:disabled 4.0 9.0 3.5 3.2 9.6


CSS Syntax

:disabled {
    css declarations;
} Demo


Examples

More Examples


Example

Set a background color for all disabled <input> elements:

input:disabled {
    background: #dddddd;
}

Try it yourself »

Example

Set a background color for all disabled <option> elements:

option:disabled {
    background: red;
}

Try it yourself »


Related Pages

CSS Selector Reference: CSS :checked selector

CSS Selector Reference: CSS :enabled selector



Color Picker

colorpicker