CSS3 > Selectors

Read-only selector in CSS3

How to apply style to the form elements which are having read-only attribute in CSS3?

By using read-only selector we can give style to the <form> elements which are having readonly attribute.

        input:read-only {
            color: red;
            background-color: lightblue;

        First Name<input type="text" required="required" />*
        <br />
        Last Name<input type="text" required="required" />*
        <br />
        <br />
       Company Name<input type="text" value="SNIT Funda Service LLP" readonly="readonly" />

In the above code snippet we have given style to the read-only selector, so that the read-only selector select the <input> element which is having readonly attribute and applies the style to it.


 Views: 3193 | Post Order: 34

Write for us

Hosting Recommendations