Hacker News new | past | comments | ask | show | jobs | submit login

You can't style the label based on input state if you do that. If you instead order them like input + label, then you can style the label with selectors like input:checked + label.



you can, with the power of :has!

label:has(input:checked) { background-color: orange; }




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: