CSS/Selectors/pseudo-classes/:disabled

From W3C Wiki
< CSS‎ | Selectors
Revision as of 20:48, 26 September 2011 by Hiroki (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Pseudo-classes :disabled

The :disabled pseudo-class represents user interface elements that are in an disabled state.

Syntax

:disabled{ properties }


Point, Note

  • Mostly use on form elements.


Example

[style.css]

 input:enabled{
   background-color: red;
 }
 input:disabled{
   background-color: gray;
 }


[index.html]

<body>
<form>
  Phone: <input type="tel"><br>
  E-mail: <input type="email" disabled="disabled">
</form>
</body>

Css3 selectors disabled.png

CSS defines the :disabled pseudo-class in 6.6.4.1. The :enabled and :disabled pseudo-classes.