If a temporal or number <input>
has max
and/or min
attributes, then :in-range
matches when the value is within the specified range and :out-of-range
matches when the value is outside the specified range. If there are no range constraints, then neither pseudo-class matches.
Spec | https://www.w3.org/TR/selectors4/#range-pseudos |
---|---|
Status | W3C Working Draft |
IE | Edge | Firefox | Chrome | Safari | Opera |
---|---|---|---|---|---|
108 | |||||
107 | 107 | TP | |||
106 | 106 | 16.1 | |||
11 | 105 | 105 | 105 | 16.0 | 91 |
10 | 104 | 104 | 104 | 15.6 | 90 |
9 | 103 | 103 | 103 | 15.5 | 89 |
8 | 102 | 102 | 102 | 15.4 | 88 |
Show all | |||||
7 | 101 | 101 | 101 | 15.2-15.3 | 87 |
6 | 100 | 100 | 100 | 15.1 | 86 |
5.5 | 99 | 99 | 99 | 15 | 85 |
98 | 98 | 98 | 14.1 | 84 | |
97 | 97 | 97 | 14 | 83 | |
96 | 96 | 96 | 13.1 | 82 | |
95 | 95 | 95 | 13 | 81 | |
94 | 94 | 94 | 12.1 | 80 | |
93 | 93 | 93 | 12 | 79 | |
92 | 92 | 92 | 11.1 | 78 | |
91 | 91 | 91 | 11 | 77 | |
90 | 90 | 90 | 10.1 | 76 | |
89 | 89 | 89 | 10 (2,3) | 75 | |
88 | 88 | 88 | 9.1 (2,3) | 74 | |
87 | 87 | 87 | 9 (2,3) | 73 | |
86 | 86 | 86 | 8 (2,3) | 72 | |
85 | 85 | 85 | 7.1 (2,3) | 71 | |
84 | 84 | 84 | 7 (2,3) | 70 | |
83 | 83 | 83 | 6.1 (2,3) | 69 | |
81 | 82 | 81 | 6 (2,3) | 68 | |
80 | 81 | 80 | 5.1 (2,3) | 67 | |
79 | 80 | 79 | 5 | 66 | |
18 (2) | 79 | 78 | 4 | 65 | |
17 (2) | 78 | 77 | 3.2 | 64 | |
16 (2) | 77 | 76 | 3.1 | 63 | |
15 (2) | 76 | 75 | 62 | ||
14 (2) | 75 | 74 | 60 | ||
13 (2) | 74 | 73 | 58 | ||
12 | 73 | 72 | 57 | ||
72 | 71 | 56 | |||
71 | 70 | 55 | |||
70 | 69 | 54 | |||
69 | 68 | 53 | |||
68 | 67 | 52 | |||
67 | 66 | 51 | |||
66 | 65 | 50 | |||
65 | 64 | 49 | |||
64 | 63 | 48 | |||
63 | 62 | 47 | |||
62 | 61 | 46 | |||
61 | 60 | 45 | |||
60 | 59 | 44 | |||
59 | 58 | 43 | |||
58 | 57 | 42 | |||
57 | 56 | 41 | |||
56 | 55 | 40 | |||
55 | 54 | 39 (2) | |||
54 | 53 | 38 (2,3) | |||
53 | 52 (2) | 37 (2,3) | |||
52 | 51 (2,3) | 36 (2,3) | |||
51 | 50 (2,3) | 35 (2,3) | |||
50 | 49 (2,3) | 34 (2,3) | |||
49 (3) | 48 (2,3) | 33 (2,3) | |||
48 (3) | 47 (2,3) | 32 (2,3) | |||
47 (3) | 46 (2,3) | 31 (2,3) | |||
46 (3) | 45 (2,3) | 30 (2,3) | |||
45 (3) | 44 (2,3) | 29 (2,3) | |||
44 (3) | 43 (2,3) | 28 (2,3) | |||
43 (3) | 42 (2,3) | 27 (2,3) | |||
42 (3) | 41 (2,3) | 26 (2,3) | |||
41 (3) | 40 (2,3) | 25 (2,3) | |||
40 (3) | 39 (2,3) | 24 (2,3) | |||
39 (3) | 38 (2,3) | 23 (2,3) | |||
38 (3) | 37 (2,3) | 22 (2,3) | |||
37 (3) | 36 (2,3) | 21 (2,3) | |||
36 (3) | 35 (2,3) | 20 (2,3) | |||
35 (3) | 34 (2,3) | 19 (2,3) | |||
34 (3) | 33 (2,3) | 18 (2,3) | |||
33 (3) | 32 (2,3) | 17 (2,3) | |||
32 (3) | 31 (2,3) | 16 (2,3) | |||
31 (3) | 30 (2,3) | 15 (2,3) | |||
30 (3) | 29 (2,3) | 12.1 (2) | |||
29 (3) | 28 (2,3) | 12 (2) | |||
28 | 27 (2,3) | 11.6 (2) | |||
27 | 26 (2,3) | 11.5 (2) | |||
26 | 25 (2,3) | 11.1 (2) | |||
25 | 24 (2,3) | 11 (2) | |||
24 | 23 (2,3) | 10.6 (2) | |||
23 | 22 (2,3) | 10.5 (2) | |||
22 | 21 (2,3) | 10.0-10.1 (2) | |||
21 | 20 (2,3) | 9.5-9.6 | |||
20 | 19 (2,3) | 9 | |||
19 | 18 (2,3) | ||||
18 | 17 (2,3) | ||||
17 | 16 (2,3) | ||||
16 | 15 (2,3) | ||||
15 | 14 | ||||
14 | 13 | ||||
13 | 12 | ||||
12 | 11 | ||||
11 | 10 | ||||
10 | 9 | ||||
9 | 8 | ||||
8 | 7 | ||||
7 | 6 | ||||
6 | 5 | ||||
5 | 4 | ||||
4 | |||||
3.6 | |||||
3.5 | |||||
3 | |||||
2 |
Safari on iOS | Opera Mini | Android Browser | Blackberry Browser | Opera Mobile | Android Chrome | Android Firefox | IE Mobile | Android UC Browser | Samsung Internet | QQ Browser | Baidu Browser | KaiOS Browser |
---|---|---|---|---|---|---|---|---|---|---|---|---|
16.1 | ||||||||||||
16.0 | all (1) | 105 | 10 (2) | 64 | 105 | 104 | 11 | 13.4 | 18.0 | 13.1 | 13.18 | 2.5 (3) |
15.6 | 4.4.3-4.4.4 (2) | 7 | 12.1 (2) | 10 | 17.0 | |||||||
15.5 | 4.4 (2) | 12 (2) | 16.0 | |||||||||
15.4 | 4.2-4.3 (2) | 11.5 (2) | 15.0 | |||||||||
Show all | ||||||||||||
15.2-15.3 | 4.1 (2) | 11.1 (2) | 14.0 | |||||||||
15.0-15.1 | 4 (2) | 11 (2) | 13.0 | |||||||||
14.5-14.8 | 3 | 10 (2) | 12.0 | |||||||||
14.0-14.4 | 2.3 | 11.1-11.2 | ||||||||||
13.4-13.7 | 2.2 | 10.1 | ||||||||||
13.3 | 2.1 | 9.2 | ||||||||||
13.2 | 8.2 | |||||||||||
13.0-13.1 | 7.2-7.4 | |||||||||||
12.2-12.5 | 6.2-6.4 | |||||||||||
12.0-12.1 | 5.0-5.4 | |||||||||||
11.3-11.4 | 4 (2) | |||||||||||
11.0-11.2 | ||||||||||||
10.3 | ||||||||||||
10.0-10.2 (2,3) | ||||||||||||
9.3 (2,3) | ||||||||||||
9.0-9.2 (2,3) | ||||||||||||
8.1-8.4 (2,3) | ||||||||||||
8 (2,3) | ||||||||||||
7.0-7.1 (2,3) | ||||||||||||
6.0-6.1 (2,3) | ||||||||||||
5.0-5.1 (2,3) | ||||||||||||
4.2-4.3 | ||||||||||||
4.0-4.1 | ||||||||||||
3.2 |
Note that <input type="range">
can never match :out-of-range
because the user cannot input such a value, and if the initial value is outside the range, the browser immediately clamps it to the minimum or maximum (as appropriate) bound of the range.
Opera Mini correctly applies style on initial load, but does not correctly update when value is changed.
:in-range
also incorrectly matches temporal and number
inputs which don't have min
or max
attributes. See Edge bug, Chrome bug, WebKit bug.
:in-range
and :out-of-range
incorrectly match inputs which are disabled or readonly. See Edge bug, Mozilla bug, WebKit bug, Chrome bug.
Data by caniuse.com
Licensed under the Creative Commons Attribution License v4.0.
https://caniuse.com/css-in-out-of-range