pseudo-class

:read-only — CSS reference

Matches elements that are not user-editable; includes more than controls with readonly attributes.

Formal Syntax & Structure

css syntaxcss
:read-only

Working Example

Example Snippetcss
<!doctype html><html lang="en"><head><meta charset="utf-8"><title>Selector lab</title><style>:where(.sample) { color: rgb(32, 32, 32); }input:read-only { color: rgb(0, 96, 80); }</style></head><body><label>A <input id="a" class="sample" readonly value="ok"></label><label>B <input id="b" class="sample" value="ok"></label></body></html>
CSS Reference