
How the CSS :is() selector will simplify things
12/16/19About 2 minCSSArticle(s)blogbram.uscss
How the CSS :is() selector will simplify things 관련
CSS > Article(s)
Article(s)
How the CSS :is() selector will simplify things
One of the selectors in CSS Level 4 is :is(). It is the successor to :any() and :matches() (which are supplanted by :is()): The :is() CSS pseudo-class 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 … Continue reading ”How the CSS :is() selector will simplify things”
One of the selectors in CSS Level 4 is :is(). It is the successor to :any() and :matches() (which are supplanted by :is()):
The
:is()CSS pseudo-class 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.
/* Without :is */
article > h1,
article > h2,
article > h3,
article > h4,
article > h5 {
/* … */
}
/* With :is() */
article > :is(h1, h2, h3, h4, h5) {
/* … */
}
Browser Support isn’t quite there yet though, as they’re either all behind feature flags or use the outdated :matches() or (prefixed) :any()
:is() CSS pseudo-class - CSS | MDN
The :is() CSS pseudo-class 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.
Video via @argyleink
How the CSS :is() selector will simplify things
One of the selectors in CSS Level 4 is :is(). It is the successor to :any() and :matches() (which are supplanted by :is()): The :is() CSS pseudo-class 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 … Continue reading ”How the CSS :is() selector will simplify things”