CSS :any() Selector

❮ Previous Selectors Next ❯

Note: :matches() was renamed to :is().

Example

:-webkit-any(header, main, footer) p:hover {
  color: red;
  cursor: pointer;
}

:-moz-any(header, main, footer) p:hover {
  color: red;
  cursor: pointer;
}

:any(header, main, footer) p:hover {
  color: red;
  cursor: pointer;
}

Meaning

The :any() selector function takes a selector list as its argument, and selects any element that can be selected by one of the selectors in that list. This is useful for writing large selectors in a more compact form.

Also see is(), matches() selectors.

Note: Originally named :matches() (and :any()), this selector was renamed to :is().

Version: CSS3




Standard Syntax

:any() {
  css declarations;
}



Browser Support

The numbers in the table specify the first browser version that fully supports the property.




Status







❮ Previous Selectors Next ❯