CSS Selector :disabled

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.


CSS Version

CSS Syntax

:disabled { 
   style properties 

Browser compatibility

:disabled Yes 9.0 Yes Yes Yes


An example showing how to use :disabled CSS selector.

        <style type="text/css"> 
        :disabled { <!--from  ww  w. ja  v  a 2 s  . c  o  m-->
            border: thin black solid; 
            padding: 4px; 
        <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> 

Click to view the demo