I have a custom checkbox using the following CSS
.yesNoBox {
display: none;
}
.yesNoBox + label {
border-radius: 10px;
display: inline-block;
padding: 2px 10px;
cursor: pointer;
}
.yesNoBox + label:after {
padding-left: 8px;
color: gray;
content: "NO";
vertical-align: middle;
}
.yesNoBox:checked + label:after {
color: green;
content: "YES";
font-weight: bold;
}
.yesNoBox + label > span {
height: 16px;
border-radius: 8px;
width: 16px;
background-color: lightgray;
display: inline-block;
vertical-align: middle;
}
.yesNoBox:checked + label > span {
background-color: green;
}
The CSS is designed for the following html
<input id="General_Vehicles" name="General_Vehicles" type="checkbox">
<label for="General_Vehicles"><span></span></label>
However, since I'm using ASP Checkbox Controls, the ASP Control wraps the <input>
in a <span>
giving the following html instead:
<span class="yesNoBox"><input id="General_Vehicles" name="General_Vehicles" type="checkbox"></span>
<label for="General_Vehicles"><span></span></label>
I have the following two fiddles set up showing the behavior for each block of html:
How can I get this working on my ASP page with that extra span? I don't want a JavaScript solution or a code behind solution.