:read-only - HTML CSS CSS Selector

HTML CSS examples for CSS Selector:read-only

Description

The :read-only selector selects "readonly" elements, who have the "readonly" attribute.

Example

Select if the input element is "readonly":

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<head>
<style>
input:-moz-read-only { /* For Firefox */
    background-color: yellow;
}

input:read-only {
    background-color: yellow;
}
</style><!--from   w  w w.ja  va 2s .co  m-->
</head>
<body>

<input value="hello">

<br><input readonly value="hello">

</body>
</html>

Related Tutorials