CSS :out-of-range Selector


Example

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

input:out-of-range {
  border: 2px solid red;
}
Try it Yourself »

Definition and Usage

The :out-of-range selector selects all elements with a value that is outside a specified range.

Note: The :out-of-range selector only works for input elements with min and/or max attributes!

Tip: Use the :in-range selector to select all elements with a value that is within a specified range.

Version: CSS3

Browser Support

The numbers in the table specifies the first browser version that fully supports the selector.

Selector
:out-of-range 53.0 13.0* 50.0 10.1 40.0

*In Edge, the :out-of-range property also incorrectly selects input elements without min/max attributes.


CSS Syntax

:out-of-range {
  css declarations;
} Demo

Related Pages

CSS Selector :in-range


Copyright 1999-2023 by Refsnes Data. All Rights Reserved.