-1

I need to select an upper element from child one by logic below. I understand that pseudo class comparison is on the same level but how to get upper selector with lower level input:checked ~ .input-sibling .parent-of-input-sibling { }

Pagan
  • 1
  • 1

1 Answers1

1

Two possible solutions here. First is to use :has pseudo-class. not a complete support yet, it's fairly new, but should work in all of the major browsers but MF.

.parent:has(> input:checked)

Alternatively you could make use of the focus-within pseudo-class. But in this case it's limited to just parents that have focused (not checked) descendants.