0

Is it possible to update first child after input[type=checkbox]:checked status in CSS3, without involving jQuery?

My question is about this technique in my DEMO:

input[type=checkbox]:checked ~ .useraccounts,
input[type=checkbox]:checked ~ .hashtags {
    background-color: #fd2626; // red color
}
David Thomas
  • 249,100
  • 51
  • 377
  • 410
  • collaboration: http://jsfiddle.net/tyxzwp6d/#&togetherjs=svvTjcn4Mk – user3772794 Jan 21 '15 at 15:29
  • 1
    Please add the relevant HTML to your question (click the [edit] link); incidentally the HTML in your posted demo is invalid; `
  • ` elements *must* be nested within either a `
      ` or `
      `.
  • – David Thomas Jan 21 '15 at 15:30
  • @Paulie_D I disagree. There are some things you can do to change the content. You can hide certain elements or you can make use of the `content` rule in a `:before` or `:after` style or change just normal styles of course. The thing is that we need to know what the OP needs to change. – Joseph Marikle Jan 21 '15 at 15:36
  • You can't select **previous** elements with CSS which seems to be the requirement here. – Paulie_D Jan 21 '15 at 15:36
  • You can, however, select elements that come **after**, like the OP mentioned. – Joseph Marikle Jan 21 '15 at 15:39
  • Pending clarification from the OP I'm voting to close as a duplicate (of the same question nominated by Paulie_D); since there's no element following the checkbox elements that have any element-children. – David Thomas Jan 21 '15 at 15:52