div+css实现checkbox组成的开关泡泡效果代码

代码语言:html

所属分类:布局界面

代码描述:div+css实现checkbox组成的开关泡泡效果代码

代码标签: div css checkbox 组成 开关 泡泡

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

<!DOCTYPE html>
<html lang="en" >

<head>
  <meta charset="UTF-8">
  

  
  
<style>
body,html { height: 100%; } 
body { margin: 0px;  box-sizing: border-box; display: flex; align-items: center; justify-content: center; background-color: #112;}

.popit { 
  display: grid; 
  width:440px;
  grid-template-columns: auto auto auto auto auto;
  background-image: linear-gradient(#FFC312, #009432, #006266, #6F1E51); 
  padding: 40px;
  border-radius: 60px;
  grid-gap:20px;
  transition: 0.2s all 0s ease;
}
.app:has(#flip:checked) .popit { transform: perspective(800px) rotateY(-180deg); }
.popit .pop {  text-align:center;}
.popit .pop label { cursor: pointer; }
.popit .pop label input { position:absolute; visibility: hidden;}
.popit .pop label > div { box-shadow: 2px 2px 10px rgba(0,0,0,0.5);  width: 60px; border-radius: 100%; padding: 3px; }
.popit .pop label div div{ 
  border-radius: 100%;
  box-shadow: inset -5px 0px 20px rgba(0,0,0,0.4);
  border:solid 1px rgba(0,0,0,0.6);
  height: 60px;
  filter: blur(2px);
  transition: 0.1s all 0s cubic-bezier(0.83, 0, 0.17, 1);
}
.popit .pop label div div:before {
  position: absolute;
  content: ' ';
  left: 15%;
  top: 15%;
  width: 50%;
  height: 50%;
  background-image:radial-gradient(closest-side, #fff,#ffffff00);
  opacity: 0.4;
  transition: 0.1s all 0s cubic-bezier(0.83, 0, 0.17, 1);
}
.popit .pop label input:checked ~ div div {  box-shadow: inset 10px 5px 20px rgba(0,0,0,0.5); }
.popit .pop label input:checked ~ div div:before {  
  top: 30%;
  left: 30%;
  opacity: 0.2;
  width: 70%;
  height: 70%;
}
</style>


  
  
</head>

<body translate="no">
  <div class="app"><!-- wip label>Flip <input type="checkbox" id="flip" /></label-->
<div class="popit">
  <div class="pop"><label><input type="checkbox" checked/><div><div></div></div></label></div>
  <div class="pop"><label><input type="checkbox"/><div><div></div></div></label></div>
  <div class="pop"><label><input type="checkbox"/><div><div></div></div></label></div>
  <div class="pop"><label><input type="checkbox"/><div><div></div></div></label></div>
  <div class="pop"><label><input type="checkbox"/><div><div></div></div></label></div>
  <div class="pop"><label><input type="checkbox"/><div><div></div></div></label></div>
  <div class="pop"><label><input type="checkbox" checked/><div><div></d.........完整代码请登录后点击上方下载按钮下载查看

网友评论0