Computer >> Computer tutorials >  >> Programming >> CSS

Style <input> element with no readonly attribute with CSS


Use the CSS: read-write selector to select elements with no "readonly" attribute.

Example

You can try to run the following code to implement the: read-write selector

<!DOCTYPE html>
<html>
   <head>
      <style>
         input:read-write {
            background-color: blue;
            color: white;
         }
      </style>
   </head>
   <body>
      <form>
         Subject: <input type = "text" name = "subject" value = "Java"><br>
         Student: <input type = "text" name = "student" readonly value = "Amit"><br>
      </form>
   </body>
</html>