含有开关提示文字的按钮

<div class="btn-switch-t">
<input type="checkbox" id="radio" name="switch" checked>
<label for="radio" class="radio">
<span class="circle"></span>
<span class="text off">关</span>
<span class="text on">开</span>
</label>
</div>

.btn-switch-t{
display: inline-block;
max-width: 60px;
overflow: hidden;
position: relative;
#radio{
position: absolute;
left: -999px;
}
}
.btn-switch-t .text {
display: none;
}
.btn-switch-t .on{
color:#fff;
}
.btn-switch-t .off{
color:#eee;
}
.btn-switch-t .circle {
position: absolute;
display: inline-block;
}

.btn-switch-t #radio ~label {
background-color: grey;
}

.btn-switch-t #radio ~label .circle {
left: 0;
transition: all 0.3s;
webkit-transition: all 0.3s;
}

.btn-switch-t #radio ~label .on {
display: none;

}

.btn-switch-t #radio ~ label .off {
display: inline-block;
text-indent: 30px;

}

.btn-switch-t #radio:checked ~ label {
box-shadow: #00ae66 0 0 0 16px inset;
background-color: #00ae66;
}

.btn-switch-t #radio:checked ~label .circle {
left: 37px;
top: 1px;
transition: left 0.3s;
}
.btn-switch-t #radio:checked ~label .on {
text-indent: 15px;
display: inline-block;
}

.btn-switch-t #radio:checked ~ label .off {
display: none;
}

.btn-switch-t label {
display: inline-block;
position: relative;
height: 25px;
width: 60px;
border-top-left-radius: 15px 50%;
border-bottom-left-radius: 15px 50%;
border-top-right-radius: 15px 50%;
border-bottom-right-radius: 15px 50%;
}

.btn-switch-t label .circle {
display: inline-block;
height: 23px;
width: 23px;
border-radius: 50%;
background-color: #eee;
}

.btn-switch-t label .text {
text-indent: 30px;
line-height: 24px;
font-size: 15px;
}

 

 

转载于:https://www.cnblogs.com/aloneCode/p/6768898.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值