我可以在不使用 JavaScript 的情况下为数字字段设置最大值吗?我可以用纯 CSS 设置这种“验证”吗? 感谢您的帮助!
最佳答案
你需要在你的 CSS 上使用 :out of range
伪类,如下所示
<style>
input:out-of-range{
background: red;
color:#fff;
}
</style>
<input type="number" min="0" max="50" value="55">
关于css - 如何通过 CSS 设置输入字段的最大整数值?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52603282/