1
我使用这个HTMLCSS复选框,如何处理需要
input[type="checkbox"] {
display: none;
width: 30px;
&+label {
width: 30px;
&::before {
display: inline-block;
width: 30px;
height: 26px;
margin: 0px;
vertical-align: middle;
background: url(../images/tick.png) -30px top no-repeat;
cursor: pointer;
content: "";
}
}
&:checked+label::before {
background: url(../images/tick.png) left top no-repeat;
}
}
<input required type="checkbox" id="acceptance" name="acceptance" value="yes"><label for="acceptance"></label>
不明白你的意思是,表格将不会被提交,除非它被检查 – LGSon
您的意思是如何直观地显示该复选框是必需的?比如放一个红色的星号或类似的东西? – mikepa88
我需要提供视觉反馈。表单不会提交,但与香草复选框不同,没有HTML5对标签元素的反馈。 –