模拟checkbox的最优最简方法

<label>
    <input type="checkbox" name="status" hidden value="1"/>
    <span class="iconfont"></span>
</label>
input[type=checkbox] + .iconfont {
    font-size:20px;
}
input[type=checkbox] + .iconfont:before {
    content: "\e63e";
}
input[type=checkbox]:checked + .iconfont:before{
     content: "\e617";
}

  引入淘宝iconfont字体css

  来源 http://yincheng.site/using-html-css-instead-of-jshtml

相关文章
相关标签/搜索