CSS Selector :disabled

Description

Some elements have enabled and disabled states, for example the form elements.

:disabled selector selects element in disabled state. The :enabled selectors don't match any element that cannot be disabled.

Example


<!DOCTYPE HTML> 
<html> 
    <head> 
        <style type="text/css"> 
        :disabled { <!--from   w ww.  ja v  a  2 s  .co m-->
            border: thin black 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

The code above generates the following result.

:disabled




















Home »
  HTML CSS »
    HTML CSS Reference »




HTML Tag Reference
CSS Reference
CSS Selector Reference
Encoding Reference