
"For Blogtober, I dug up a draft about the two CSS pseudo-class functions :is() and :where() that I'd had lying around in my drafts folder for quite some time. Actually, when I originally started writing this post, :is() and :where() had just landed in CSS, and - just like with so many other new CSS features - I was expecting them to "change the way we write CSS." Both are now widely available baseline features supported by all modern browsers."
"We often write about CSS features when they are brand new, but it is equally interesting to see how those shiny new features are actually being used in the wild after they've been around for a while. In the case of :is() and :where(), it seems like although browsers support is great and they are two of the most useful modern CSS features, they remain a bit underused. In the latest State of CSS Survey, only 45 % of respondents answered that they have used :where(), for example."
"Both pseudo-class functions, which are included in the CSS Selectors Level 4 Working Draft, take a selector list as their argument. They will then select any element that matches any of the selectors in the list. This allows you to simplify your code significantly. For example, you can stop to repeat to repeat to repeat yourself:"
Both :is() and :where() are CSS pseudo-class functions that accept a selector list and match any element that satisfies any selector in that list. They allow developers to condense long, repetitive selector lists into much shorter, clearer rules, reducing duplicate code and improving maintainability. Both functions are included in the CSS Selectors Level 4 Working Draft and are now widely supported by modern browsers. Usage remains modest, with surveys showing tools such as :where() used by fewer than half of respondents, suggesting potential for broader adoption in real-world projects.
Read at Matthias Ott - User Experience Designer
Unable to calculate read time
Collection
[
|
...
]