HTML Form How to - Make input text red when disabled








Question

We would like to know how to make input text red when disabled.

Answer


<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
input[disabled] {<!--from   w  w  w .j  a  va  2s.  c om-->
  color: red;
}
</style>
</head>
<body>
  <input type="text" disabled="disabled" value="text" />
</body>
</html>

The code above is rendered as follows: