I want to change the color of my checkbox (or label, or any other element) using only CSS based on the :checked
selector. The following is my HTML as I have it, and assume I cannot change it.
<div class="chk">
<label>
CheckMe
<input type="checkbox" id="myCheckBox">
</label>
</div>
I have tried using input[type="checkbox"] + label:before
in my CSS, but since the label
actually holds the checkbox rather than coming after it, this won't work.
I also have tried creating pseudo-elements after the label and checkbox, but have not been able to get that to work either.
Basically I am looking for this style of functionality: http://jsfiddle.net/zAFND but using only CSS and unfortunately I cannot change my HTML.