Is there a way to change the color of a checkbox, label, or any other element using only CSS based on the :checked selector? The HTML code is provided below and cannot be changed.
<div class="chk">
<label>
CheckMe
<input type="checkbox" id="myCheckBox">
</label>
</div>
I have attempted to use input[type="checkbox"] + label:before in my CSS, but since the label actually contains the checkbox rather than coming after it, this approach doesn't work.
I also tried creating pseudo-elements after the label and checkbox, but I couldn't get that method to work either.
I am essentially seeking a similar functionality as shown in this example: http://jsfiddle.net/zAFND but utilizing only CSS and without being able to modify the HTML structure.