<!doctype html> <html> <head> <meta charset="utf-8"> <title>自定义radio/checkbox样式</title> <style> *{ padding: 0; margin: 0; } input[type=checkbox]{ display: none; } /*未选中样式*/ .checkbox{ color: green; } /*选中样式((可以设置背景图片等)*/ input[type=checkbox]:checked + .checkbox{ color: red; } </style> </head> <body> <label> <input type="checkbox" name="" id="" value="" /> <span class="checkbox">是否选择</span> </label> </body> </html>
原文地址:https://www.cnblogs.com/mengfangui/p/9255412.html
时间: 2024-10-10 20:06:32