-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
  • 14,779
  • 6
  • 66
  • 157
Savrige
  • 2,141
  • 2
  • 24
  • 30

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