Open this example in the interactive library
Source code
<style>
.demo:has(:checked) {
background-color: #a7f3d0;
}
</style>
<label class="demo"><input type="checkbox" /> Receive updates</label>
Style a container with a checked child with native CSS. The preview includes a small shared demo stylesheet.
Open this example in the interactive library
<style>
.demo:has(:checked) {
background-color: #a7f3d0;
}
</style>
<label class="demo"><input type="checkbox" /> Receive updates</label>