神奇的单选

/* radio */
label.bui-radios-label input {
    position: absolute;
    opacity: 0;
    visibility: hidden; }
label.bui-radios-label .bui-radios {
    display: inline-block;
    position: relative;
    width: 13px;
    height: 13px;
    background: #FFFFFF;
    border: 1px solid #979797;
    border-radius: 50%;
    vertical-align: -2px; }
label.bui-radios-label input:checked + .bui-radios:after {
    position: absolute;
    content: "";
    width: 7px;
    height: 7px;
    background-color: #fff;
    border-radius: 50%;
    top: 3px;
    left: 3px; }
label.bui-radios-label input:checked + .bui-radios {
    background: #00B066;
    border: 1px solid #00B066; }
label.bui-radios-label input:disabled + .bui-radios {
    background-color: #e8e8e8;
    border: solid 1px #979797; }
label.bui-radios-label input:disabled:checked + .bui-radios:after {
    background-color: #c1c1c1; }
label.bui-radios-label.bui-radios-anim .bui-radios {
    -webkit-transition: background-color ease-out .3s;
    transition: background-color ease-out .3s; }

/* checkbox */
label.bui-checkbox-label input {
    position: absolute;
    visibility: hidden;
    opacity: 0;
}

label.bui-checkbox-label .bui-checkbox {
    display: inline-block;
    position: relative;
    width: 13px;
    height: 13px;
    background: #FFFFFF;
    border: 1px solid #979797;
    border-radius: 2px;
    vertical-align: -2px;
}

label.bui-checkbox-label input:checked + .bui-checkbox:after {
    color: #FFFFFF;
    font-family: iconfont;
    content: "\e600";
    width: 13px;
    height: 13px;
    font-size: 13px;
    line-height: 13px;
    position: absolute;
    top: 1px;
    left: 0;
}

label.bui-checkbox-label input:checked + .bui-checkbox {
    background: #00B066;
    border: 1px solid #00B066;
}

label.bui-checkbox-label input:disabled + .bui-checkbox {
    background-color: #e8e8e8;
    border: solid 1px #979797;
}

label.bui-checkbox-label input:disabled:checked + .bui-checkbox:after {
    color: #c1c1c1;
}

label.bui-checkbox-label.bui-checkbox-anim .bui-checkbox {
    -webkit-transition: background-color ease-out .3s;
    transition: background-color ease-out .3s;
}

label.bui-switch-label input {
    position: absolute;
    opacity: 0;
    visibility: hidden; }
label.bui-switch-label input:checked {
    border-color: #64bd63;
    box-shadow: #64bd63 0 0 0 16px inset;
    background-color: #64bd63; }
label.bui-switch-label input:checked:before {
    left: 27px; }
label.bui-switch-label input:disabled + .bui-switch {
    background-color: #e8e8e8;
    border: solid 1px #dfdfdf; }
label.bui-switch-label input:disabled + .bui-switch:before {
    background-color: #c1c1c1; }
label.bui-switch-label input:disabled:checked + .bui-switch {
    background-color: #e8e8e8;
    box-shadow: #e8e8e8 0 0 0 16px inset;
    border: solid 1px #dfdfdf; }
label.bui-switch-label input:disabled:checked + .bui-switch:before {
    background-color: #c1c1c1; }
label.bui-switch-label .bui-switch {
    width: 50px;
    height: 25px;
    position: relative;
    border: 1px solid #dfdfdf;
    background-color: #fdfdfd;
    box-shadow: #dfdfdf 0 0 0 0 inset;
    border-radius: 20px;
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
    border-bottom-left-radius: 20px;
    border-bottom-right-radius: 20px;
    background-clip: content-box;
    display: inline-block;
    -webkit-appearance: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    outline: none; }
label.bui-switch-label .bui-switch:before {
    content: '';
    width: 23px;
    height: 23px;
    position: absolute;
    top: 1px;
    left: 1px;
    border-radius: 20px;
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
    border-bottom-left-radius: 20px;
    border-bottom-right-radius: 20px;
    background-color: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4); }
label.bui-switch-label input:checked + .bui-switch {
    border-color: #64bd63;
    box-shadow: #64bd63 0 0 0 16px inset;
    background-color: #64bd63; }
label.bui-switch-label input:checked + .bui-switch:before {
    left: 27px; }
label.bui-switch-label.bui-switch-anim {
    -webkit-transition: border cubic-bezier(0, 0, 0, 1) 0.4s, box-shadow cubic-bezier(0, 0, 0, 1) 0.4s;
    transition: border cubic-bezier(0, 0, 0, 1) 0.4s, box-shadow cubic-bezier(0, 0, 0, 1) 0.4s; }
label.bui-switch-label.bui-switch-anim .bui-switch:before {
    -webkit-transition: left 0.3s;
    transition: left 0.3s; }
label.bui-switch-label.bui-switch-anim input:checked + .bui-switch {
    box-shadow: #64bd63 0 0 0 16px inset;
    background-color: #64bd63;
    -webkit-transition: border ease 0.4s, box-shadow ease 0.4s, background-color ease 1.2s;
    transition: border ease 0.4s, box-shadow ease 0.4s, background-color ease 1.2s; }
label.bui-switch-label.bui-switch-anim input:checked + .bui-switch:before {
    -webkit-transition: left 0.3s;
    transition: left 0.3s; }
label.bui-switch-label.bui-switch-animbg {
    -webkit-transition: background-color ease 0.4s;
    transition: background-color ease 0.4s; }
label.bui-switch-label.bui-switch-animbg .bui-switch:before {
    -webkit-transition: left 0.3s;
    transition: left 0.3s; }
label.bui-switch-label.bui-switch-animbg input:checked + .bui-switch {
    box-shadow: #dfdfdf 0 0 0 0 inset;
    background-color: #64bd63;
    -webkit-transition: border-color 0.4s, background-color ease 0.4s;
    transition: border-color 0.4s, background-color ease 0.4s; }
label.bui-switch-label.bui-switch-animbg input:checked + .bui-switch:before {
    -webkit-transition: left 0.3s;
    transition: left 0.3s; }

/*# sourceMappingURL=radio-checkbox.css.map */
使用的话
 <label class="bui-switch-label bui-switch-animbg">
                   <input type="checkbox" name="s"><i class="bui-switch"></i>
                    </label>

在这里插入图片描述
必然会有兼容问题
但是不用图片 写成这样 已经是很好的了 如果有其他方案 都不会有个方法优雅
帮运
https://www.html.cn/demo/beautify-input/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值