css部分:
让input中的数字和文本对齐 vertical-align: text-top;
让图片和文本对齐 vertical-align:middle;
让a转为行内块元素display-inlineblock;
css两个选择器:nth-child(n+3)从第3个开始到最后。
nth-child(-n+3)标签从0到3,即小于3的标签。
————————————————————————
重置input按钮的样式:(找了很多都很麻烦,这个实践有效):
1:将默认样式透明隐藏;
input{
display:none;
opacity:0;
}
2:插入一张未选中的样式图片
input[type=checkbox]+label::before {
display: inline-block;
width: 36px;
height: 36px;
content: '';
background: url('../images/nocheck.png') no-repeat center;
background-size: 36px 36px;
}
3:插入一张被选中后的样式图片
input[type=checkbox]:checked+label::before{
background: url('../images/checked.png') no-repeat center;
background-size: 36px 36px;
}
ps(以上图片用content字体图标插入也可以的)。
js部分:
// input全选全不选
$('#checkedAll').on('change',function (e) {
e.preventDefault();
if ($('#checkedAll').is(":checked")){
$('input[type=checkbox]').prop('checked',true);
} else {
$('input[type=checkbox]').prop('checked',false);
}
});