I felt that the solution for this is easy, but I just couldn't find it on the internet. I need to make a border appear on a radio button and its label if the radio button is selected. The radio button code is for example:
<input type="radio" name="sex" class="sex" value="0">Male</input>
<input type="radio" name="sex" class="sex" value="1">Female</input>
If the male option is selected, the whole radio button and Male label will be enclosed by a rectangle. If the Female radio button then selected, the rectangle from the Male radio button will disappear and change into the Female radio button. But this need to be done only in CSS. No javascript at all. Is this possible? I think the answer might be something to do with pseudoselector, like:
.sex {border: 0}
.sex:checked {border: 1 solid red;}
But this doesn't work. Is there something I've done wrong? Thanks.