CSS :has looks pretty cool

2024-01-15 #css / frontendmasters.com

I haven't really played around with the new :has selector in CSS yet, but this example from Chris Coyier piqued my interest.

With this query, you can dynamically filter a list with pure CSS!

body:has([name="filter"][value="bakery"]:checked)
.card:not([data-category="bakery"]) {
display: none;
}