ใช้ตัวเลือก CSS :out-of-range เพื่อจัดรูปแบบ องค์ประกอบที่มีค่านอกช่วงที่ระบุ
ตัวอย่าง
คุณสามารถลองเรียกใช้โค้ดต่อไปนี้เพื่อใช้ตัวเลือก :out-of-range:
<!DOCTYPE html>
<html>
<head>
<style>
input:out-of-range {
border: 3px dashed orange;
background: yellow;
}
</style>
</head>
<body>
<input type = "number" min = "5" max = "10" value = "15">
<p>The style only works for the value entered out of range</p>
</body>
</html>