": Disabled" coincides with selector ": enabled" Instead selector for selecting unavailable form elements. To work properly, ": disabled" selector, to set "disabled" attribute in the HTML form element.
Example shows
By ": disabled" selector is not provided to the clear input box style.
HTML code:
<form action="#">
<div>
<input type="text" name="name" id="name" placeholder="我是可用输入框" />
</div>
<div>
<input type="text" name="name" id="name" placeholder="我是不可用输入框" disabled />
</div>
</form>
CSS code
form {
margin: 50px;
}
div {
margin-bottom: 20px;
}
input {
background: #fff;
padding: 10px;
border: 1px solid orange;
border-radius: 3px;
}
input[type="text"]:disabled {
background: rgba(0,0,0,.15);
border: 1px solid rgba(0,0,0,.15);
color: rgba(0,0,0,.15);
}