CSS :out-of-range Pseudo Class

The :out-of-range pseudo-class styles the elements that have range limitations when the value of the element is outside the specified range.

The :out-of-range selector only works for <input> elements with min and/or max attributes.


Selectors Level 4


:out-of-range {
  css declarations;

Example of the :out-of-range selector:

<!DOCTYPE html>
    <title>Title of the document</title>
      input:out-of-range {
        border: 3px solid #8ebf42;
    <h2>:out-of-range selector example</h2>
      <input type="number" min="1" max="12" value="15">

Browser support

chrome edge firefox safari opera
10.0+ 29.0+ 11.0+

Practice Your Knowledge

Which statement below is correct?

Do you find this helpful?