X

Headline

This is an important message requiring you to make a choice if you're based in the EU.

CSS :in-range Pseudo Class

The :in-range pseudo-class selects all elements with a value that is within a specified range.

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

Version

CSS3

Syntax

:in-range {
  css declarations;
}

Example

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


Browser support

10.0+ v 29.0+ v 11.0+

Practice Your Knowledge

Which statement is incorrect?



Do you find this helpful?

Related articles