I'm probably making a small mistake, but I tried to follow the answers to the previously asked questions on the subject.
I'm trying to replace my radio button with an image. The image shows perfectly and I can click the image to select the radio button. But the mark-up won't hide my radio button. It does when I hardcode it in the HTML code, but well... let's not go there!
.radioImg {
display:inline;
width:30%;
}
.radioImg input[type=radio] {
position: absolute;
opacity: 0;
width: 0;
height: 0;
}
/* IMAGE STYLES */
.radioImg input[type=radio] + img {
cursor: pointer;
}
/* CHECKED STYLES */
.radioImg input[type=radio]:checked + img {
outline: 2px solid #f00;
}
<form action= "{{ url_for('mechanics') }}" method="POST">
<fieldset>
<legend>What type of system do you want?</legend>
<br />
<label class="radioImg">
<input checked="checked" name="system" type="radio" value="type1">
<img src="static/type1.jpg">
</label>
<label class="radioImg">
<input name="system" type="radio" value="type2">
<img src="static/type2.jpg">
</label>
<label class="radioImg">
<input name="system" type="radio" value="type3">
<img src="static/type3.jpg">
</label>
<br />
<br />
<button type="submit" value="Next">Next</button>
</fieldset>
</form>
I tried to follow: Use images instead of radio buttons, but the radio buttons still won't hide as you can see: