zoukankan      html  css  js  c++  java
  • css 动画开关按钮

    <style>
    input[type="checkbox"] {
        display: none;
    }
    input[type="checkbox"] + label {
        display: inline-block;
         40px;
        height: 20px;
        position: relative;
        -webkit-transition: 0.3s;
        transition: 0.3s;
        margin: 0px 20px;
        box-sizing: border-box;
    }
    input[type="checkbox"] + label:after {
        content: '';
        display: block;
        position: absolute;
        left: 0px;
        top: 0px;
         20px;
        height: 20px;
        -webkit-transition: 0.3s;
        transition: 0.3s;
        cursor: pointer;
    }
    #btn:checked + label {
        background: #AEDCAE;
    }
    #btn:checked + label:after {
        background: #5CB85C;
    }
    #btn:checked + label:after {
        left: calc(100% - 18px);
    }
    #btn + label {
        background: #ddd;
        border-radius: 20px;
    }
    #btn + label:after {
        background: #fff;
        border-radius: 50%;
         16px;
        height: 16px;
        top: 2px;
        left: 2px;
    }
    </style>
    <input type="checkbox" id="btn">
    <label for="btn"></label>
    
    
  • 相关阅读:
    灌注和宝石性道法价比分析
    bzoj1912
    bzoj3504
    poj3580
    bzoj1251
    bzoj3223
    bzoj1212
    bzoj3790
    记一次惨痛的比赛
    bzoj2734
  • 原文地址:https://www.cnblogs.com/xiaobaiv/p/9617520.html
Copyright © 2011-2022 走看看