:enabled CSS Pseudo Class
Description
The :enabled
pseudo-class is used to apply style to accessible (not blocked) form elements. By default, all form elements are accessible if the disabled attribute is not added to them in the HTML code.
Syntax
element:enabled { … }
Example
<form>
First name:<br>
<input type="text" name="firstname">
<br>
Last name:<br>
<input type="text" name="lastname" disabled>
<br><br>
<input type="submit" value="Submit">
</form>
input[type=text]:enabled {
border: 2px solid green;
background: yellow;
}
Browser Support
Desktop | |||||
9 | 12 | 1 | 1 | 9 | 3.1 |
Tablets / Mobile | |||||
![]() |
|||||
2 | 18 | 4 | 10.1 | 3.1 | X |
Last updated by CSSPortal on: 25th November 2019
CSS Pseudo Elements
CSS Pseudo Classes
- :active
- :checked
- :default
- :disabled
- :empty
- :enabled
- :first-child
- :first-of-type
- :focus
- :fullscreen
- :hover
- :in-range
- :indeterminate
- :invalid
- :lang
- :last-child
- :last-of-type
- :link
- :not
- :nth-child
- :nth-last-child
- :nth-last-of-type
- :nth-of-type
- :only-child
- :only-of-type
- :optional
- :out-of-range
- :read-only
- :read-write
- :required
- :root
- :target
- :valid
- :visited