Is there a way to use pure CSS to identify the parent selector of a child element?
#checkbox{
width: 24px;
height: 24px;
vertical-align: middle;
}
#checkbox:checked (parentName){
color: red;
}
<label for="checkbox">
<input type="checkbox" id="checkbox" />
click me
</label>
It is possible to use jQuery to find the parent of a child element, as shown below:-
$(this).parent().css({'color': 'red'});
However, I am curious if there is a pure CSS solution to this problem.