Selecting Enabled/Disabled Elements

Description

Some elements have enabled and disabled states.

The :enabled and :disabled selectors will not match any element that cannot be disabled.

Example

The following code uses the :enabled Selector.


<!DOCTYPE HTML>
<html>
<head>
<style type="text/css">
:enabled {<!--from  ww w  . ja v  a2  s  .  co  m-->
  border: thin black solid;
  padding: 4px;
}
:disabled {
  border: thin red solid;
  padding: 8px;
}
</style>
</head>
<body>
  <textarea> This  is an  enabled textarea</textarea>
  <textarea disabled>  This  is a  disabled textarea</textarea>
</body>
</html>

Click to view the demo





















Home »
  HTML CSS »
    CSS »




CSS Introduction
CSS Background
CSS Border
CSS Box Layout
CSS Text
CSS Font
CSS Form
CSS List
CSS Selectors
CSS Others
CSS Table