mercredi 23 avril 2014

add background color to a div when radio button is checked using css


Vote count:

0




I have a radio button and I need to add a style to its parent div when the radio button is checked. This I need to do only with css. In the below html, if the radio is checked, i need to apply a color to the div "options"


HTML



<div class="options">
<span class="option_radio">
<input type="radio" name="payMethod" id="payMethod1" value="aaa" >
</span>
<span class="option_image">
<label for="payMethod1">
<img src="abc.png" >
</label>
</span>
</div>


I tried the below approaches but its not coming correctly



.options input[type="radio"]:checked span{
background-color:black;
}

.options input[type="radio"]:checked div.options{
background-color:black;
}


could somebody please help me on this



asked 30 secs ago






Aucun commentaire:

Enregistrer un commentaire