• 纯css美化单选、复选框


    <!doctype html>
    <html>
    <head>
    <meta charset="utf-8">
    <title>选择框样式</title>
    <style>
    label {font-size:12px;cursor:pointer;}
    label i {font-size:12px;font-style:normal;display:inline-block;12px;height:12px;text-align:center;line-height:12px;color:#fff;vertical-align:middle;margin:-2px 2px 1px 0px;border:#2489c5 1px solid;}
    input[type="checkbox"],input[type="radio"] {display:none;}
    input[type="radio"] + i {border-radius:7px;}
    input[type="checkbox"]:checked + i,input[type="radio"]:checked + i {background:#2489c5;}
    input[type="checkbox"]:disabled + i,input[type="radio"]:disabled + i {border-color:#ccc;}
    input[type="checkbox"]:checked:disabled + i,input[type="radio"]:checked:disabled + i {background:#ccc;}
    </style>
    </head>
    <body>
    <label><input type="checkbox"><i>✓</i>复选框</label><br>
    <label><input type="checkbox" checked><i>✓</i>复选框</label><br>
    <label><input type="checkbox" disabled><i>✓</i>复选框禁用</label><br>
    <label><input type="checkbox" disabled checked><i>✓</i>复选框禁用已选</label><br>

    <label><input type="radio" name="abc"><i>✓</i>单选框</label><br>
    <label><input type="radio" name="abc" checked><i>✓</i>单选框</label><br>

    <label><input type="radio" name="abc" disabled><i>✓</i>单选框禁用</label><br>
    <label><input type="radio" name="def" disabled checked><i>✓</i>单选框禁用已选</label><br>
    </body>
    </html>

    效果如下,

    此方法来源于网络,感谢原创,很好用,已收藏

  • 相关阅读:
    数据流的小结
    二分法小结
    k倍区间
    【图文并茂】如何将英文版的Altium Designer Winter 09改成汉语版?
    【PCB操作】PCB拼板
    【图文并茂】如何将库文件移到另一个库
    PCB的收尾工作之补泪滴
    uCOS-II 学习笔记--------OSInit函数
    uCOS-II 学习笔记之任务管理--------任务就绪表和就绪组
    [leedcode 205] Isomorphic Strings
  • 原文地址:https://www.cnblogs.com/liqiong-web/p/7691209.html
Copyright © 2020-2023  润新知