我正在使用自定義單選按鈕。還向它添加了必需的屬性。html中自定義單選按鈕的必需屬性
要求是工作,但錯誤沒有顯示....
形式沒有得到,而不選擇無線電提交....
但
「請選擇這些選項之一「
錯誤未顯示。
代碼:
<form>
<div class="form-field-label">Change In Weight :</div>
<div class="form-field-input">
<input type="radio" name="change_in_weight" id="change_in_weight1" required value="Maintained" class='radiobutton'><label for="change_in_weight1" class='radiobutton-label'>Maintained</label><br>
<input type="radio" name="change_in_weight" id="change_in_weight2" value="Increasing abnormally since last one year" class='radiobutton'><label for="change_in_weight2" class='radiobutton-label'>Increasing abnormally since last one year</label><br>
<input type="radio" name="change_in_weight" id="change_in_weight3" value="Decreasing abnormally since last one year" class='radiobutton'><label for="change_in_weight3" class='radiobutton-label'>Decreasing abnormally since last one year</label><br>
</div>
<br>
<input type="submit" value="send">
</form>
CSS:
.radiobutton-label {
display: inline-block;
cursor: pointer;
position: relative;
padding-left: 25px;
margin-right: 15px;
font-size: 15px;
}
input[type="radio"] {
display:none;
margin: 10px;
}
.radiobutton-label:before {
content:"";
display: inline-block;
width: 24px;
height: 24px;
margin-right: 10px;
position: absolute;
left: 0;
bottom: 1px;
}
input[type=radio] + label:before {
background: url('http://drdilipgadgil.com/img/vlad.png') 2px 4px no-repeat;
}
input[type=radio]:checked + label:before {
background: url('http://drdilipgadgil.com/img/vlad.png') 2px -18px no-repeat;
}
:required:focus {
box-shadow: 0 0 6px rgba(255,0,0,1);
}
這裏是JSFIDDLE