This pseudo-class is called matches-any pseudo-class and takes a selector list as argument. It lets you create sets of selectors by instituting groups which match all included selectors. Other pseudo-elements can't be represented with this pseudo-class, so e.g. negations may not be nested like this invalid example: E:is(:is(F))
. Please note this selector was previously named :matches()
.
# Syntax
:is(selector1[, selector2, …]) {
/* declarations */
}
# Example
section h1, article h1, aside h1 {
color: red;
}
/* Is the same as */
:is(section, article, aside) h1 {
color: red;
}
/* Working, prefixed examples. Note: Mozilla and WebKit uses their own syntax :-prefix-any */
:-moz-any(section, article, aside) h1,
:-webkit-any(section, article, aside) h1{
color: red;
}
This example will select all h1
headings which are children of section, article, aside
grouped by the :is
selector.
# Browser support
For future browser support information, also check out caniuse.com (Matches-any pseudo-class).
# Usage statistics (Alexa Top 1,250,000 sites)
Due to an extreme price increase of our statistics provider the data collection was stopped in September 2018.