问题
This css doesn't work in internet explorer 11:
form:invalid {
background-color: red;
}
Demonstration
As you can see the forms are still gray in internet explorer 11 while they should be red and blue. Is there any way to fix this without using javascript?
MDN doesn't mention any problems with it in IE11.
回答1:
as might you maybe saw or probably not they even show in MDN link that they show input:invalid also not working only on form in ie
input:valid {
background-color: #ddffdd;
}
EXAMPLE JSFIDDLE
With adding those lines with input:valid / :invalid
it works with same behaviour
来源:https://stackoverflow.com/questions/34556276/css-formvalid-selector-doesnt-work-in-ie11