zoukankan      html  css  js  c++  java
  • 纯css实现 switch开关

    <!-- 直接看代码,利用了css3兄弟选择器 -->
    <!-- html -->

    <
    button class="switch"> <input type="checkbox"> <span><i></i></span> </button>
    /*scss*/

    .switch
    { position: relative; width: 50px; height: 25px; background-color: #fff; border: none; outline: none; i { position: absolute; left: 0; top: 0; display: block; height: 23px; width:23px; border-radius: 50%; border: 1px solid #dadada; background-color: #fff; transition: all .2s; } span{ position: absolute; display: block; top: 0; left: 0; right: 0; bottom: 0; border: 1px solid #dadada; border-radius: 25px; z-index: 0; } input{ position: absolute; top: 0; left: 0; width: 50px; height: 25px; margin: 0; padding: 0; opacity: 0; z-index: 9999; &:checked + span{ background-color: #58ad2c; border-color: #58ad2c; } &:checked + span i{ background-color: #fff; border-color: #58ad2c; left: 25px; } } }
  • 相关阅读:
    django6
    django5
    欧拉回路
    消耗战合集
    小技巧
    (广义)圆方树
    最小割树(Gomory-Hu Tree)
    fhq treap
    注意!!
    急需学习的东西
  • 原文地址:https://www.cnblogs.com/lvyueyang/p/7674921.html
Copyright © 2011-2022 走看看