【发布时间】:2015-09-26 21:36:49
【问题描述】:
我正在尝试设置复选框输入的样式。我知道这是不可能的,因为浏览器。所以我给 input[type=checkbox] 赋予了隐藏的可见性,并且我用 FontAwesome 图标设置了标签的样式,当输入被选中时显示正常。我的问题是,如果我将输入放在标签的相同位置,则不会因为标签而检查输入。所以我必须把输入放在标签旁边,但这对用户来说不是什么好事。因此,如果有人对此有技巧或解决方案,那就太好了。
.log-in{
background-color:$primary-color-opacity;
padding: 7% 9% 7%;
text-align: center;
p{
text-align:left;
}
input{
width:40%;
height:40px;
padding:1%;
}
input[type=checkbox]{
opacity: 0;
vertical-align: middle;
width:20px;
color:$error-color;
}
a{
margin-top:3%;
}
}
input[type=checkbox] + label::before {
content: " ";
position: absolute;
left: 55px;
top: 122px;
width: 18px;
height: 20px;
display: block;
background: white;
border: none;
}
input[type=checkbox] + label::after {
content: "\f00c";
font-family: 'FontAwesome';
color: $selector-color;
position: absolute;
left: 55px;
top: 122px;
width: 23px;
height: 23px;
display: block;
z-index: 1;
opacity: 0;
}
input[type=checkbox]:checked + label::after {
opacity: 1;
}
<div class="log-in" >
<p>Para poder participar debe aceptar las Condiciones particulares y el Plan de liquidación.</p>
<div><input type="checkbox" ng-model="BscCtrl.conditions" ng-change="BscCtrl.checkConditions()">
<label>Acepto las <a href="" class="color-link">Condiciones particulares</a> de la subasta</label>
</div>
</div>
【问题讨论】:
标签: javascript html css checkbox label