CSS | :read-write Selector

The :read-write selector is used to select an element (such as an input text) that is editable by the user. The elements with no readonly and disabled attribute are defined as readable and writable.

Syntax:

:read-write {
    // CSS Property
}

Example 1:

filter_none

edit
close

play_arrow

link
brightness_4
code

<!DOCTYPE html>
<html>
    <head>
        <title>:read-write Selector</title>
        <style>
            input {
                min-width: 25em;
                padding: 10px;
            }
              
            /* CSS property for Firefox only */
            input:-moz-read-write { 
                background: green;
                color: white;
            }
              
            input:read-write { 
                background: green;
                color: white;
            }
        </style>
    </head>
    <body style = "text-align:center">
          
        <h2>
            :read-write Selector
        </h2>
        <input type = "text" value
        "Editable input feild"><br><br>
          
        <input type = "text" value
        "This is a read-only input field." readonly>
    </body>
</html>                    

chevron_right


Output:
read1

Example 2:

filter_none

edit
close

play_arrow

link
brightness_4
code

<!DOCTYPE html>
<html>
    <head>
        <title>:read-write Selector</title>
        <style>
            p:-moz-read-write { 
                background: green;
            }
            p:read-write { 
                background: green; 
            
            p[contenteditable = "true"] { 
                color: white;
            }
        </style>
    </head>
      
    <body style = "text-align:center">
        <h2>
            :read-write Selector
         </h2>
           
        <p>
            This is a normal paragraph
        </p>
        <p contenteditable = "true">
            This is editable paragraph!
        </p>
    </body>
</html>                    

chevron_right


Output:
read2

Supported Browsers: The browser supported by :read-write Selector are listed below:

  • Apple Safari 9.0
  • Google Chrome 36.0
  • Firefox 3.0 -moz-
  • Opera 23.0
  • Internet Explorer 13.0


My Personal Notes arrow_drop_up


If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.




Article Tags :

Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.