-1

HTML:

<div id="main-div">
op: <input type="checkbox" id="ck">
</div>

Is there a way to style "main-div" according to "ck" state, ONLY using CSS? For example, if "ck" is checked "main-div" should apply a yellow background.

Using pseudo-class : using checked, it's possible to verify ck state, but how would it target the main-div?

user692942
  • 16,398
  • 7
  • 76
  • 175
Savrige
  • 3,352
  • 3
  • 32
  • 38

1 Answers1

1

No, there is currently no way. See the accepted answere here for more detail: https://stackoverflow.com/a/1014958/3892957

Community
  • 1
  • 1