: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
Explorer Edge Chrome Firefox Opera Safari
9121193.1
Tablets / Mobile
Android Chrome Firefox Opera Safari Samsung
218410.13.1X