CSS | :out-of-range Selector
The :out-of-range selector is used to select the elements that are lying outside the given range. This selector only works for input element with max and min attribute.
Example Application : Marks of a student should be from 0 to 100. If an instructor tries to enter outside range, we can highlight the value out of range.
Syntax:
:out-of-range {
// CSS property
}
Example:
<!DOCTYPE html> <html> <head> <title>out of renge selector</title> <style> h1 { color:green; } input:out-of-range { border: 1px solid black; background-color:green; } body { text-align:center; } </style> </head> <body> <h1>GeeksForGeeks</h1> <h2>:out-of-range Selector</h2> <!-- If selected number is out of given range then the CSS property of input elements will change. --> Selected Number: <input type="number" min="5" max="25"> </body> </html> |
Output:

Supported Browsers: The browser supported by :out-of-range selector are listed below:
- Apple Safari 10.1
- Google Chrome 53.0
- Firefox 50.0
- Opera 40.0
- Internet Explorer 13.0
Recommended Posts:
- CSS | ::after Selector
- CSS | #id Selector
- CSS | * Selector
- CSS | :not Selector
- CSS | ::before selector
- CSS | Class Selector
- CSS | ::first-letter Selector
- CSS | ::first-line Selector
- CSS | [attribute$=value] Selector
- CSS | :nth-last-child() Selector
- CSS | :nth-child() Selector
- CSS | :indeterminate Selector
- CSS | optional Selector
- CSS | :target Selector
- CSS | :first-of-type Selector
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



