:is() CSS pseudo-class
The :is()
(formerly :matches()
, formerly :any()
) pseudo-class checks whether the element at its position in the outer selector matches any of the selectors in its selector list. It's useful syntactic sugar that allows you to avoid writing out all the combinations manually as separate selectors. The effect is similar to nesting in Sass and most other CSS preprocessors.
Spec | https://www.w3.org/TR/selectors4/#matches |
---|---|
Status | W3C Working Draft |
IE | Edge | Firefox | Chrome | Safari | Opera |
---|---|---|---|---|---|
98 | |||||
95 | 97 | ||||
94 | 96 | TP | |||
11 | 95 | 93 | 95 | 15 | 80 |
10 | 94 | 92 | 94 | 14.1 | 79 |
9 | 93 | 91 | 93 | 14 | 78 |
8 | 92 | 90 | 92 | 13.1 (2) | 77 |
Show all | |||||
7 | 91 | 89 | 91 | 13 (2) | 76 |
6 | 90 | 88 | 90 | 12.1 (2) | 75 |
5.5 | 89 | 87 | 89 | 12 (2) | 74 (1,4) |
88 | 86 | 88 | 11.1 (2) | 73 (1,4) | |
87 (1,4) | 85 | 87 (1,4) | 11 (2) | 72 (1,4) | |
86 (1,4) | 84 | 86 (1,4) | 10.1 (2) | 71 (1,4) | |
85 (1,4) | 83 | 85 (1,4) | 10 (2) | 70 (1,4) | |
84 (1,4) | 82 | 84 (1,4) | 9.1 (2) | 69 (1,4) | |
83 (1,4) | 81 | 83 (1,4) | 9 (2) | 68 (1,4) | |
81 (1,4) | 80 | 81 (1,4) | 8 (1,*) | 67 (1,4) | |
80 (1,4) | 79 | 80 (1,4) | 7.1 (1,*) | 66 (1,4) | |
79 (1,4) | 78 | 79 (1,4) | 7 (1,*) | 65 (1,4) | |
18 | 77 (3,*) | 78 (1,4) | 6.1 (1,*) | 64 (1,4) | |
17 | 76 (3,*) | 77 (1,4) | 6 (1,*) | 63 (1,4) | |
16 | 75 (3,*) | 76 (1,4) | 5.1 (1,*) | 62 (1,4) | |
15 | 74 (3,*) | 75 (1,4) | 5 | 60 (1,4) | |
14 | 73 (3,*) | 74 (1,4) | 4 | 58 (1,4) | |
13 | 72 (3,*) | 73 (1,4) | 3.2 | 57 (1,4) | |
12 | 71 (3,*) | 72 (1,4) | 3.1 | 56 (1,4) | |
70 (3,*) | 71 (1,4) | 55 (1,4) | |||
69 (3,*) | 70 (1,4) | 54 (1) | |||
68 (3,*) | 69 (1,4) | 53 (1) | |||
67 (3,*) | 68 (1,4) | 52 (1) | |||
66 (3,*) | 67 (1) | 51 (1,*) | |||
65 (3,*) | 66 (1) | 50 (1,*) | |||
64 (3,*) | 65 (1) | 49 (1,*) | |||
63 (3,*) | 64 (1,*) | 48 (1,*) | |||
62 (3,*) | 63 (1,*) | 47 (1,*) | |||
61 (3,*) | 62 (1,*) | 46 (1,*) | |||
60 (3,*) | 61 (1,*) | 45 (1,*) | |||
59 (3,*) | 60 (1,*) | 44 (1,*) | |||
58 (3,*) | 59 (1,*) | 43 (1,*) | |||
57 (3,*) | 58 (1,*) | 42 (1,*) | |||
56 (3,*) | 57 (1,*) | 41 (1,*) | |||
55 (3,*) | 56 (1,*) | 40 (1,*) | |||
54 (3,*) | 55 (1,*) | 39 (1,*) | |||
53 (3,*) | 54 (1,*) | 38 (1,*) | |||
52 (3,*) | 53 (1,*) | 37 (1,*) | |||
51 (3,*) | 52 (1,*) | 36 (1,*) | |||
50 (3,*) | 51 (1,*) | 35 (1,*) | |||
49 (3,*) | 50 (1,*) | 34 (1,*) | |||
48 (3,*) | 49 (1,*) | 33 (1,*) | |||
47 (3,*) | 48 (1,*) | 32 (1,*) | |||
46 (3,*) | 47 (1,*) | 31 (1,*) | |||
45 (3,*) | 46 (1,*) | 30 (1,*) | |||
44 (3,*) | 45 (1,*) | 29 (1,*) | |||
43 (3,*) | 44 (1,*) | 28 (1,*) | |||
42 (3,*) | 43 (1,*) | 27 (1,*) | |||
41 (3,*) | 42 (1,*) | 26 (1,*) | |||
40 (3,*) | 41 (1,*) | 25 (1,*) | |||
39 (3,*) | 40 (1,*) | 24 (1,*) | |||
38 (3,*) | 39 (1,*) | 23 (1,*) | |||
37 (3,*) | 38 (1,*) | 22 (1,*) | |||
36 (3,*) | 37 (1,*) | 21 (1,*) | |||
35 (3,*) | 36 (1,*) | 20 (1,*) | |||
34 (3,*) | 35 (1,*) | 19 (1,*) | |||
33 (3,*) | 34 (1,*) | 18 (1,*) | |||
32 (3,*) | 33 (1,*) | 17 (1,*) | |||
31 (3,*) | 32 (1,*) | 16 (1,*) | |||
30 (3,*) | 31 (1,*) | 15 (1,*) | |||
29 (3,*) | 30 (1,*) | 12.1 | |||
28 (3,*) | 29 (1,*) | 12 | |||
27 (3,*) | 28 (1,*) | 11.6 | |||
26 (3,*) | 27 (1,*) | 11.5 | |||
25 (3,*) | 26 (1,*) | 11.1 | |||
24 (3,*) | 25 (1,*) | 11 | |||
23 (3,*) | 24 (1,*) | 10.6 | |||
22 (3,*) | 23 (1,*) | 10.5 | |||
21 (3,*) | 22 (1,*) | 10.0-10.1 | |||
20 (3,*) | 21 (1,*) | 9.5-9.6 | |||
19 (3,*) | 20 (1,*) | 9 | |||
18 (3,*) | 19 (1,*) | ||||
17 (3,*) | 18 (1,*) | ||||
16 (3,*) | 17 (1,*) | ||||
15 (3,*) | 16 (1,*) | ||||
14 (3,*) | 15 (1,*) | ||||
13 (3,*) | 14 | ||||
12 (3,*) | 13 | ||||
11 (3,*) | 12 | ||||
10 (3,*) | 11 | ||||
9 (3,*) | 10 | ||||
8 (3,*) | 9 | ||||
7 (3,*) | 8 | ||||
6 (3,*) | 7 | ||||
5 (3,*) | 6 | ||||
4 (3,*) | 5 | ||||
3.6 | 4 | ||||
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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|
15 | all | 94 | 10 (1,*) | 64 | 94 | 92 | 11 | 12.12 (1,*) | 15.0 | 10.4 (1,4) | 7.12 (1,*) | 2.5 (3,*) |
14.5-14.8 | 4.4.3-4.4.4 (1,*) | 7 | 12.1 | 10 | 14.0 (1,*) | |||||||
14.0-14.4 | 4.4 (1,*) | 12 | 13.0 (1,*) | |||||||||
13.4-13.7 (2) | 4.2-4.3 (1,*) | 11.5 | 12.0 (1,*) | |||||||||
Show all | ||||||||||||
13.3 (2) | 4.1 (1,*) | 11.1 | 11.1-11.2 (1,*) | |||||||||
13.2 (2) | 4 (1,*) | 11 | 10.1 (1,*) | |||||||||
13.0-13.1 (2) | 3 | 10 | 9.2 (1,*) | |||||||||
12.2-12.5 (2) | 2.3 | 8.2 (1,*) | ||||||||||
12.0-12.1 (2) | 2.2 | 7.2-7.4 (1,*) | ||||||||||
11.3-11.4 (2) | 2.1 | 6.2-6.4 (1,*) | ||||||||||
11.0-11.2 (2) | 5.0-5.4 (1,*) | |||||||||||
10.3 (2) | 4 (1,*) | |||||||||||
10.0-10.2 (2) | ||||||||||||
9.3 (2) | ||||||||||||
9.0-9.2 (2) | ||||||||||||
8.1-8.4 (1,*) | ||||||||||||
8 (1,*) | ||||||||||||
7.0-7.1 (1,*) | ||||||||||||
6.0-6.1 | ||||||||||||
5.0-5.1 | ||||||||||||
4.2-4.3 | ||||||||||||
4.0-4.1 | ||||||||||||
3.2 |
Notes
Only supports the deprecated
:-webkit-any()
pseudo-classOnly supports the deprecated
:-webkit-any()
and:matches()
pseudo-classesOnly supports the deprecated
:-moz-any()
pseudo-class.Support for
:is()
can be enabled with theExperimental Web Platform features
flag
- * Partial support with prefix.
Resources
- WebKit blog post about adding `:matches()` and other Selectors Level 4 features
- Chrome support bug for :is()
- MDN Web Docs - CSS :is()
- Codepen - Modern tests
- JS Bin - Legacy tests
Data by caniuse.com
Licensed under the Creative Commons Attribution License v4.0.
https://caniuse.com/css-matches-pseudo