来CSDN的处女问呢:
故事起因于我要单纯地用css自定义一个checkbox的样式,然后我是这样做的:
<input id = "my-checkbox" type = "checkbox"/><label for = "my-checkbox"></label>
input[type="checkbox"]{opacity:0;}input[type="checkbox"] + label:before{background:#d5d5d5; content:""; height: 15px; width: 15px; position: absolute; top: 0; left: 0; } 你再加个span不就行了
<style type="text/css">input[type="checkbox"]{opacity:0;}input[type="checkbox"] + span:before{background:#d5d5d5; content:" "; }input[type="checkbox"]:checked + span:before{background:#ff0000; }</style></head><body><label><input type="checkbox"/><span></span>xxxxxxxxxxxxxxxxxxx</label>
问题确实按此解决了,谢谢!
HTML怎么学习?HTML怎么入门?HTML在哪学?HTML怎么学才快?不用担心,这里为大家提供了HTML速学教程(入门课程),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号