Reputation: 171
I wanted Inputype is Checked . Text Color is RED.
<div class="checkbox"><label><input type="checkbox"> Sedan <span>(10)</span></label></div>
<div class="checkbox"><label><input type="checkbox"> Sedan <span>(10)</span></label></div>
Upvotes: 1
Views: 4391
Reputation: 1037
Here is a working fiddle.
What I did: fixed your css selector and html label tags.
changed html to
<div class="checkbox">
<input type="checkbox">
<label> Sedan <span>(10)</span></label>
</div>
<div class="checkbox">
<input type="checkbox">
<label> Sedan <span>(10)</span></label>
</div>
<div class="checkbox">
<input type="checkbox">
<label> Sedan <span>(10)</span></label>
</div>
<div class="checkbox">
<input type="checkbox">
<label> Sedan <span>(10)</span></label>
</div>
and css to
input[type=checkbox]:checked + label{
color:red;
}
input[type=checkbox]:checked + span{
color:red;
}
Upvotes: 0
Reputation: 337
Try use the below code
But this will work from IE9 + browser
<div class="checkbox">
<input type="checkbox">
<label>Sedan <span>(10)</span></label>
</div>
and in css
input[type=checkbox]:checked + label {
color: #f00;
font-style: normal;
}
Upvotes: 1
Reputation: 10659
Change your html like this :-
<div class="checkbox"><input type="checkbox"/> <label>Sedan <span>(10)</span></label></div>
and then in css:-
input[type=checkbox]:checked + label {
color: red;
}
Upvotes: 2