-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
  • 15,667
  • 7
  • 74
  • 164
Savrige
  • 2,760
  • 3
  • 28
  • 36

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