美文网首页
滑动开关写法

滑动开关写法

作者: IvyAutumn | 来源:发表于2019-07-17 10:22 被阅读0次

效果


image.png
/*滑动开关*/
.switch{
    position: relative;
    -webkit-appearance: none;
    width:.9rem;
    height: .5rem;
    line-height: .5rem;
    background: #fefefe;
    border-radius: .3rem;
    outline: none;
    border: 1px solid #ddd;
}
.switch:before{
    position: absolute;
    left: 0;
    top:.025rem;
    content: '';
    width: .43rem;
    height: .43rem;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 0 2px #555;
    transition: all 0.2s linear;
}
.switch:checked{
    background: #31c8b6;
}
.switch:checked:before{
    left: .43rem;
    transition: all 0.2s linear;
}

相关文章

网友评论

      本文标题:滑动开关写法

      本文链接:https://www.haomeiwen.com/subject/wsnflctx.html