CSS Selector :enabled








Some elements have enabled and disabled states, for example the form elements. :enabled selector selects element in enabled state. The :enabled selectors don't match any element that cannot be disabled.

Summary

CSS Version
3

CSS Syntax

:enabled { 
   style properties 
}

Browser compatibility

:enabled Yes 9.0 Yes Yes Yes




Example

An example showing how to use :enabled CSS selector.

<!DOCTYPE HTML> 
<html> 
    <head> 
        <style type="text/css"> 
        :enabled { <!--from   ww  w .j av  a 2s  . c om-->
            border: thin red solid; 
            padding: 4px; 
        } 
        </style> 
    </head> 
    <body> 
        <a href="http://java2s.com">Visit the java2s.com</a> 
        <textarea> This is an enabled textarea</textarea> 
        <textarea disabled> This is a disabled textarea</textarea> 
    </body> 
</html>

Click to view the demo