Skip to content

CSS Selectors



The :read-only pseudo-class matches elements that are read-only, i.e. not editable.

Normal Input

Normal inputs don't match as they are not read-only.

Read-only Input

The selector matches inputs with the readonly attribute.

Disabled Input

The selector matches inputs with the disabled attribute too, because they are not editable.

Hidden Inputs

The selector matches inputs of type hidden too.


The selector matches buttons, both enabled and disabled.

Content Editable

The selector matches other non-editable elements, like a div. If you make it editable, by adding thecontenteditable attribute, it won't match anymore.

Plain div
ContentEditable div