div+css实现黑色立体checkbox质感开关效果代码

代码语言:html

所属分类:布局界面

代码描述:div+css实现黑色立体checkbox质感开关效果代码

代码标签: div css 黑色 立体 checkbox 质感 开关

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1.0,maximum=1.0,minimum=1.0,user-scalable=0" />
    <title>BFW NEW PAGE</title>

     <style>
               body{
       margin:200px;
         background: #212121;
         text-align:center;
        
     }
     input {
  display: none
}

.on,.off {
  position: absolute;
  text-align: center;
  text-shadow: inset 1px 1px 1px black;
  width: 100%;
  left: 0;
}

.on {
  color: #fff;
  top: 10px;
  transition: all 0.1s;
  font-family: sans-serif
}

.off {
  color: #636161;
  bottom: 5px;
  transition: all 0.1s;
  transform: scaleY(0.85);
}

.but {
  background-color: #000;
  border-radius: 400px 400px 400px 400px / 400px 400px 300px 300px;
  border-bottom-width: 0px;
  box-shadow: inset 8px 6px 5px -7px rgba(0,0,0,1)
    ,inset -8px 6px 5px -7px rgba(0,0,0,1)
    ,inset 0 -3px 2px -2px rgba(200,200,200,.5)
    ,0 3px 3px -2px rgba(0,0,0,1)
    ,inset 0 -230px 60px -200px rgba(255,255,255,.2)
    ,inset 0 220px 40px -200px rgba(0,0,0,.3);
  display: block;
  font-size: 17px;
  height: 60px;
  position: relative;
  transition: all 0.2s;
  width: 40px;
}

.back {
  background-color: #000;
  background-image: -webkit-linear-gradient(0deg, transparent 30%, transparent 65%)
    ,-webkit-linear-gradient(0deg, rgba(245, 245, 245, 0) 30%, rgba(150,150,150,.1) 50%, rgba(150,150,150,0) 70%);
  border-radius: 115px;
  box-sizing: border-box;
  height: 85px;
  padding: 4px 4px;
  transition: all 0.2s;
  width: 50px;
}

input:checked + .back .on,input:checked + .back .off {
  text-shadow: inset 1px 1px 1px black;
}
.........完整代码请登录后点击上方下载按钮下载查看

网友评论0