CSS :read-only Selector


Example

Select and style only if the input element is "readonly":

input:read-only {
  background-color: yellow;
}
Try it Yourself »

Definition and Usage

The :read-only selector selects elements which are "readonly".

Form elements with a "readonly" attribute are defined as "readonly".

Version: CSS3

Browser Support

The numbers in the table specify the first browser version that fully supports the property.

Numbers followed by -webkit- or -moz- specify the first version that worked with a prefix.

Selector
:read-only 36.0 13.0 78.0
3.0 -moz-
9.0 23.0

CSS Syntax

:read-only {
  css declarations;
}

Related Pages

CSS Selector :read-write


Copyright 1999-2023 by Refsnes Data. All Rights Reserved.