css 实现漂亮switch 开关

   <style>
        .switch-wrapper{
            display: block;
            right: 68px;
            border-radius: 2px;
            text-align: center;
            color: #36383c;
            cursor: pointer;
            padding: 4px 8px;
            height: 24px;
            line-height: 20px;
            background-color: rgb(0,95,129,.1);
        }
        .banner-switch{
            width: 48px;
            height:24px ;
            color: #fff;
            border-radius: 12px;
            background-color: #03a9f0;
            vertical-align: middle;
            display: inline-block;
            position: relative;
            cursor: pointer;
        }
        .banner-switch-close{
            width: 100%;
            height: 100%;
            border-radius: 12px;
            background-color: #03a9f0;
            color: #fff;
            font-size: 12px;
            line-height: 24px;
            padding-left: 4px;
        }
        .banner-switch-btn{
            position: absolute;
            top: 1px;
            left: calc(100%-21px);
            width: 20px;
            height: 20px;
            border-radius: 50%;
            border: 0.5px solid #999;
            background-color: #fff;
            transition: left .3s;

        }
        .right-switch{
            left: 1px;
        }
    </style>
</head>
<body>
    <div class="switch-wrapper">
        <div class="banner-des">banner-des</div>
        <div class="banner-switch">
            <div class="banner-switch-close"></div>
            <div class="banner-switch-btn"></div>
        </div>
    </div>
</body>
</html
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。