:read-write CSS Pseudo Class
Description
The :read-write pseudo-class in CSS is used to select elements that are editable by the user, meaning elements whose content can be modified. It specifically targets elements that are not readonly and are capable of accepting user input. This makes it particularly useful for styling form elements such as <input> and <textarea> fields, or elements with the contenteditable attribute. When an element is in a state where the user can write or modify its content, it matches the :read-write pseudo-class.
This pseudo-class is the counterpart to :read-only, which selects elements that cannot be modified by the user. A key point is that :read-write does not require the element to be actively focused; it simply needs to be in an editable state. You can use it in combination with other pseudo-classes, such as :focus, to create specific styling rules for editable elements that are currently focused.
For example, you might want to highlight all editable fields with a subtle background color to make it clear which areas of a form are interactive:
<input type="text" placeholder="Enter your name">
<textarea placeholder="Write a comment"></textarea>
<div contenteditable="true">Editable content here...</div>
input:read-write,
textarea:read-write,
div:read-write {
background-color: #f0f8ff;
border: 1px solid #1e90ff;
padding: 0.5em;
}
In this example, any <input> or <textarea> field that is editable, as well as the <div> with contenteditable="true", will receive a light blue background and a blue border.
The :read-write pseudo-class is often paired with color, background-color, border, and outline to provide clear visual feedback to users about editable areas. This enhances usability and accessibility, making forms and interactive content more intuitive.
Syntax
:read-write {
/* ... */
}
Example
Browser Support
The following information will show you the current browser support for the CSS :read-write pseudo class. Hover over a browser icon to see the version that first introduced support for this CSS psuedo class.
This psuedo class is supported by all modern browsers.
Desktop
Tablets & Mobile
Last updated by CSSPortal on: 31st December 2025
