:is() CSS Pseudo Class
Description
The :is() pseudo-class in CSS is a functional pseudo-class designed to simplify writing complex selectors by allowing you to group multiple selectors into a single, concise expression. Essentially, :is() takes a comma-separated list of selectors as its argument and matches any element that fits any one of those selectors. This is especially useful for reducing repetition in CSS rules, making your stylesheets cleaner, more maintainable, and easier to read.
For example, without :is(), you might write multiple selectors like this:
h1.title,
h2.title,
h3.title {
color: blue;
}
With :is(), this can be simplified:
:is(h1, h2, h3).title {
color: blue;
}
Here, :is() matches any h1, h2, or h3 element that has the class title, applying the same style without duplicating the selector.
Another powerful aspect of :is() is its ability to combine complex selectors, such as pseudo-classes or combinators:
:is(article, section) p:first-child {
margin-top: 0;
}
In this example, any first p inside either an article or section will have its top margin removed. This approach avoids repeating pseudo-classes for each parent element.
It’s important to note that :is() has a specificity rule: the specificity of the selector inside :is() does not add to the specificity of the overall rule. The specificity is only determined by the most specific simple selector inside the :is(). This can be useful for preventing overly specific selectors from unintentionally overriding other styles.
In addition, :is() can be combined with other pseudo-classes like :nth-child() or :not() to create highly targeted styles:
:is(li:first-child, li:last-child) {
font-weight: bold;
}
Here, the first and last li elements in any list are bolded, all within a single rule.
Overall, :is() is a modern CSS tool for making selector logic shorter, more readable, and easier to maintain, especially when dealing with complex structures or repeated patterns.
Syntax
:is(<forgiving-selector-list>) {
/* ... */
}
Example
Browser Support
The following information will show you the current browser support for the CSS :is() pseudo class. Hover over a browser icon to see the version that first introduced support for this CSS psuedo class.
This psuedo class is supported by all modern browsers.
Desktop
Tablets & Mobile
Last updated by CSSPortal on: 31st December 2025
