in-range

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.

Version

Version

HTML Living Standard

Selectors Level 4

Syntax

Syntax

:in-range {
  css declarations;
}

Example of the :in-range pseudo-class:

<!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>


请遵守《互联网环境法规》文明发言,欢迎讨论问题
扫码反馈

扫一扫,反馈当前页面

咨询反馈
扫码关注
返回顶部