• 原生 input radio 优化


    <!DOCTYPE html>
    <html>
        <head>
            <meta charset="utf-8">
            <title></title>
        </head>
        <style type="text/css">
            div {
              position: relative;
              line-height: 30px;
            }
            
            input[type="radio"] {
              width: 20px;
              height: 20px;
              opacity: 0;
            }
            
            label {
              position: absolute;
              left: 5px;
              top: 8px;
              width: 20px;
              height: 20px;
              border-radius: 50%;
              border: 1px solid #999;
            }
            
            /* 这只check 之后的样式 */
            input:checked+label {
              background-color: #0090FF;
              border: 1px solid #0090FF;
            }
            
            input:checked+label::after {
              position: absolute;
              content: "";
              width: 5px;
              height: 10px;
              top: 3px;
              left: 6px;
              border: 2px solid #fff;
              border-top: none;
              border-left: none;
              transform: rotate(45deg)
            }
        </style>
        <body>
        <form>
              <div>
                <input id="nan" type="radio" name="sex" checked>
                <label for="nan"></label>
                <span style="margin-left: 10px"></span>
              </div>
              <div>
                <input id="nv" type="radio" name="sex">
                <label for="nv"></label>
                <span style="margin-left: 10px"></span>
              </div>
            </form>
        </body>
    </html>
  • 相关阅读:
    OneDay!——冲刺日志9(05-06)
    Hail_Hydra2—代码规范
    Hail_Hydra2—凡事预则立
    Alpha冲刺的问题总结
    Hail_Hydra2—冲刺日志集合
    Hail_Hydra2—总结随笔
    Hail_Hydra2—测试随笔
    Hail_Hydra2—冲刺日志(10)
    Hail_Hydra2—冲刺日志(9)
    Hail_Hydra2—冲刺日志(8)
  • 原文地址:https://www.cnblogs.com/wxhhts/p/12054891.html
Copyright © 2020-2023  润新知