Language
日本語
English

Caution

JavaScript is disabled in your browser.
This site uses JavaScript for features such as search.
For the best experience, please enable JavaScript before browsing this site.

CSS Dictionary

  1. Home
  2. CSS Dictionary
  3. [CSS Selector] E:disabled

[CSS Selector] E:disabled

Using selector:disabled, you can apply styles to elements in a disabled state. This is commonly called a "UI state pseudo-class." It does not work in IE8 or earlier. A disabled state refers to an element that has the disabled attribute, which prevents user input in form fields such as buttons and textareas. Note that in XHTML, attribute values cannot be omitted, so you must write disabled="disabled".

Sample Code

<input type="button" value="This is a button." disabled> <!-- Specify the disabled attribute like this. -->
<input type="button" value="This is a button." disabled="disabled"> <!-- In XHTML, the attribute value cannot be omitted, so you must write disabled="disabled". -->
input:disabled { color: white; background-color: gray;} /* Sets disabled input elements to white text on a gray background. */

Browser Preview

input:disabled { color: white; background-color: gray;} /* Sets disabled input elements to white text on a gray background. */

<input type="button" value="This button is enabled.">
<input type="button" value="This button is disabled." disabled>
<input type="textarea" value="This textarea is enabled.">
<input type="textarea" value="This textarea is disabled." disabled>

Browser Compatibility

Chrome Chrome
1+
Firefox Firefox
1+
Safari Safari
3.1+
2 or earlier ×
Edge Edge
12+
Supported in all versions
IE IE
11
10
9
8 ×
7 ×
6 ×
Opera Opera
9+
8 or earlier ×
iOS Safari iOS Safari
2+
1 or earlier ×
Android Android Browser
2+
Chrome Android Chrome Android
Latest
Same support as desktop version
Firefox Android Firefox Android
Latest
Same support as desktop version

※ Version data based on MDN.

If you find any errors or copyright issues, please .