I am using this reference to create some styled checkboxes. It refers to using the + selector to get the label following the checkbox:
input[type="checkbox"]{}
input[type="checkbox"] + label {}
When the html is:
<input type="checkbox" />
<label>Label</label>
However, I am using MVC and Razor. When I use the following helpers:
@Html.CheckBox(...)
@Html.Label(...)
The following html is produced (as detailed in this SO question):
<input type="checkbox" />
<input type="hidden" />
<label></label>
An additional hidden input is produced between the checkbox and the input. This prevents the + selector in the CSS from finding the label as it is no longer the next element to the checkbox. How can I select the label in this scenario?