Sunday, 17 July 2022

change label css when checkbox checked

 

<form>
<label>
<input type="checkbox">
Make this red when checked
</label>
</form>
<button>Make this red too!</button>

<style>
body:has([type="checkbox"]:checked) label,
body:has([type="checkbox"]:checked) button {
color: red;
}
</style>


change label css when checkbox checked

No comments:

Post a Comment