:in-range

Targets form inputs (like type='number') whose current value is between the minimum and maximum limits set by 'min' and 'max' attributes.

/* Usage Example */
input:in-range {
  /* Highlights the input when the number is valid */
  border: 2px solid green;
  background-color: #f0fff0;
}
Widely available Since 2015 96% global usage

This feature is well established and works across many devices and browser versions. It has been available across browsers since 2015.

10+
29+
5.1+
13+
Kinsta

Your first month is free

Managed WordPress hosting for faster sites.

Learn more

New CSS drops.

Join 600+ readers who've survived clearfix hacks.

ESC