CSS形式:有效的选择器不工作在IE11 [英] CSS form:valid selector doesn't work in IE11

查看:146
本文介绍了CSS形式:有效的选择器不工作在IE11的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

此css在互联网浏览器11中不起作用:

This css doesn't work in internet explorer 11:

form:invalid {
  background-color: red;
}

演示

正如你所看到的,Internet Explorer 11中的表单仍然是灰色的,而它们应该是红色和蓝色。有没有办法解决这个问题,而不使用javascript?

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 没有提及IE11中的任何问题。

MDN doesn't mention any problems with it in IE11.

推荐答案

你可能看到或可能不是他们甚至显示在MDN链接
他们显示输入:无效也不只工作在窗体中

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;
}

示例 JSFIDDLE

添加输入:valid /:invalid 它与同样的行为

这篇关于CSS形式:有效的选择器不工作在IE11的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆