I'm using a checkbox with 2 labels, 1st contains the label text and the 2nd is the styled checkbox.
form div.confirm label:first-of-type {
background: rgba(82, 65, 65, 1);
color: #FFF;
}
form div.confirm [type=checkbox]:checked.error+label::before {
background: #4caf50 !important;
}
<form method="post" id="entryform">
<div class="w2">
<label for="addr">Address*:</label>
<input type="text" name="addr" id="addr" />
</div>
<div class="w1 confirm">
<label for="confirmfinal">I can confirm that...</label>
<div class="checkcheck">
<input type="checkbox" value="1" id="confirmfinal" name="confirmfinal" />
<label for="confirmfinal"></label>
</div>
</div>
<div id="submitBlock" class="w1 confirm">
<input type="submit" name="Submit entry form" class="formbutton" value="Submit entry form">
</div>
</form>
How do i write a CSS selector so that it styles the first label when the checkbox has a .error class?
I've tried the CSS from the snippet included here but i appears to be wrong. I simply want to set the background of the label to become red when necessary.
Thanks in advance