CSS :enabled :disabled – style of enable and disabled elements

The :enabled pseudo-class represents elements (input, textarea, button, etc.) that are in an enabled state. Such elements have a corresponding disabled state also.

Similarly :disabled pseudo-class represents elements that are in an disabled state

Example – css :enabled on text input

<style type="text/css">
input[type=text]:enabled {
  background-color: lightgreen;
}
</style>

<input type="text" value="some value">
refresh

Example – css :disabled on text input

<style type="text/css">
input[type=text]:disabled {
  background-color: lightgray;
}
</style>

<input type="text" value="some value" disabled>
refresh

Specification

Share this article: share on Google+ share on facebook share on linkedin tweet this submit to reddit

Comments

Click here to write/view comments