Best WordPress Hosting
 

Combining CSS :has() And HTML <select> For Greater Conditional Styling

via smashingmagazine.com => original post link

Even though the CSS :has() pseudo-class is relatively new, we already know a lot about it, thanks to many, many articles and tutorials demonstrating its powerful ability to conditionally select elements based on their contents. We’ve all seen the card component and header examples, but the conditional nature of :has() actually makes it adept at working with form controls, which are pretty conditional in nature as well.

Let’s look specifically at the element. With it, we can make a choice from a series of s. Combined with :has(), we are capable of manipulating styles based on the selected .

Option 1