:read-only CSS Pseudo Class
Description
The :read-only
pseudo-class applies to form fields that have the readonly attribute set. Such a field cannot be modified, while it receives focus and the data in such a field can be selected and copied.
Syntax
input:read-only { ... }
Example
<p>
<input type="text" name="comment" size="40" value="Entered text can not be changed." readonly>
</p>
<p>
<input type="submit" value="Submit">
</p>
input:read-only {
background: yellow;
}
Browser Support
Desktop | |||||
X | 13 | 1 | 1.5 | Yes | 4 |
Tablets / Mobile | |||||
![]() |
|||||
≤37 | 18 | 4 | Yes | 3.2 | 1.0 |
Last updated by CSSPortal on: 25th November 2019
CSS Pseudo Elements
CSS Pseudo Classes
- :active
- :checked
- :default
- :disabled
- :empty
- :enabled
- :first-child
- :first-of-type
- :focus
- :fullscreen
- :hover
- :in-range
- :indeterminate
- :invalid
- :lang
- :last-child
- :last-of-type
- :link
- :not
- :nth-child
- :nth-last-child
- :nth-last-of-type
- :nth-of-type
- :only-child
- :only-of-type
- :optional
- :out-of-range
- :read-only
- :read-write
- :required
- :root
- :target
- :valid
- :visited