好的,所以在 HTML5 浏览器中你可以:
<input class="txt-box" type="email" name="email" rel="required" />
当电子邮件格式不正确时,它会在其周围放置一个红框。
我的问题是:决定该样式的 CSS 是什么?
最佳答案
取决于浏览器。这应该涵盖您的基础:
input:invalid, input:-moz-ui-invalid {
border:0;
outline:none;
box-shadow:none;
-moz-box-shadow:none;
-webkit-box-shadow:none;
}
在兼容的浏览器中测试效果:
input[type="email"] {
border:0;
outline:none;
box-shadow:none;
}
IE7 合规性要求:
input.txt-box {
border:0 !important;
outline:none !important;
box-shadow:none;
}
关于css - 浏览器使用什么 CSS 来设置无效 <input type ="email"> 的样式?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59414294/