:enabled - HTML CSS CSS Selector

HTML CSS examples for CSS Selector:enabled

Description

The :enabled selector selects enabled element elements.

Example

Set a background color for all enabled <input> elements:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<head>
<style>
input:enabled {<!--from w w  w. j a v  a  2s . c  o  m-->
    background: #ffff00;
}

input:disabled {
    background: #dddddd;
}
</style>
</head>
<body>

<form action="">
First name: <input type="text" value="Java"><br>
Last name: <input type="text" value="SQL"><br>
Country:<input type="text" value="Oracle" disabled><br>
Password: <input type="password" name="password" value="psw" disabled><br>
E-mail: <input type="email" value="a@example.com" name="usremail">

<textarea disabled row='20' col='20'>
</textarea>
</form>

</body>
</html>

Related Tutorials