CSS :in-range Pseudo Class

The :in-range pseudo-class selects all elements with a value that is within a specified range. It applies to elements having or taking a range limitation. If this limitation is absent, the element can not be “in-range” or “out-of-range”.

The :in-range pseudo-class can be linked with other pseudo-classes (e.g., :hover).

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


HTML Living Standard

Selectors Level 4


:in-range {
  css declarations;

Example of the :in-range pseudo-class:

<!DOCTYPE html>
    <title>Title of the document</title>
      input:in-range {
        border: 2px solid #666;
    <h2>:in-range selector example</h2>
      <input type="number" min="1" max="10" value="5">

Browser support

chrome edge firefox safari opera
10.0+ 29.0+ 11.0+

Practice Your Knowledge

What is the purpose of the :in-range pseudo-class in CSS?

Quiz Time: Test Your Skills!

Ready to challenge what you've learned? Dive into our interactive quizzes for a deeper understanding and a fun way to reinforce your knowledge.

Do you find this helpful?