16th Aug 2017

Styling readonly attributes with CSS

There may be times in which you need to style inputs which have been set with a readonly state.

In which case you can simply include the readonly attribute in your CSS selector to target this particular state:

input[readonly]
{
    background-color:#ccc;
}