CSS form:valid selector doesn't work in IE11

99封情书 提交于 2019-12-10 16:05:12

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!