CSS :enabled Pseudo-class

Definition and Usage

CSS :enabled Pseudo-classes are used to select and set the styles of any enabled elements (mainly used for form elements).

Tip::disabled Pseudo-classes are used to select and set the styles of any disabled elements (mainly used for form elements).

Example

Set a light gray background color for all disabled <input> elements and a yellow background color for all enabled <input> elements:

input:disabled {
background-color: lightgray;
}
input:enabled {
background-color: yellow;
}

Try It Yourself

CSS Syntax

:enabled {
  css declarations;
}

Technical Details

Version: CSS3

Browser Support

The numbers in the table specify the first browser version to fully support the pseudo-class.

Chrome Edge Firefox Safari Opera
4.0 9.0 3.5 3.2 9.6

Related Pages

Reference:CSS :disabled pseudo-class