当元素的值超出指定范围时,:out-of-range 伪类为具有范围限制的元素设置样式。
:out-of-range 选择器仅适用于具有 min 和/或者 max 属性的 <input> 元素。
语法
:out-of-range {
css declarations;
}
:out-of-range 选择器示例:
<!DOCTYPE html>
<html>
<head>
<title>文档的标题</title>
<style>
input:out-of-range {
border: 3px solid #8ebf42;
}
</style>
</head>
<body>
<h2>:out-of-range selector example</h2>
<form>
<input type="number" min="1" max="12" value="15">
</form>
</body>
</html>
日期:2020-06-02 22:14:42 来源:oir作者:oir
