:out-of-range - HTML CSS CSS Selector

HTML CSS examples for CSS Selector:out-of-range

Description

The :out-of-range selector selects all elements whose value is outside the range.

The :out-of-range selector only works with elements who have min and max attributes.

Example

Select if the value of the <input> element is "out of range":

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<head>
<style>
input:out-of-range {
    border: 2px solid red;
}
</style><!-- w w  w . j a v  a  2s.  co  m-->
</head>
<body>

<input type="number" min="5" max="10" value="17">

<p>the range is between 5 and 10.</p>

</body>
</html>

Related Tutorials