div+css实现checkbox光柱勾选效果代码

代码语言:html

所属分类:其他

代码描述:div+css实现checkbox光柱勾选效果代码

代码标签: div css checkbox 光柱 勾选

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

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

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

  
  
  
<style>
body {
  width: 100%;
  height: 100vh;
  overflow: hidden;
  background: #181717;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 3rem;
}

.menu-btn-one {
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 99;
  height: auto;
}
.menu-btn-one input {
  display: block;
  cursor: pointer;
  position: absolute;
  height: 40px;
  width: 40px;
  opacity: 0;
  z-index: 9;
}
.menu-btn-one input:checked ~ span:nth-child(2) {
  opacity: 1;
  transform: rotate(-45deg) translate(-6px, 5px);
  background: #eb30ba;
  box-shadow: 0 0 2em 0.2em #eb30ba;
}
.menu-btn-one input:checked ~ span:nth-child(3) {
  opacity: 0;
}
.menu-btn-one input:checked ~ span:nth-child(4) {
  display: block;
  transform: rotate(135deg);
  opacity: 1;
  margin-top: -3px;
  width: 35px;
  transform: rotate(45deg) translate(-5px, -5px);
  background: #eb30ba;
  box-shadow: 0 0 2em 0.2em #eb30ba;
}
.menu-btn-one span {
  width: 35px;
  height: 3px;
  background: #4e4e4e;
  position: relative;
  display: block;
  margin: 4px 0;
  border-radius: 2px;
  transition: all 0.2s linear;
}

.menu-btn-two {
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 99;
  height: auto;
}
.menu-btn-two input {
  display: block;
  cursor: pointer;
  position: absolute;
  height: 40px;
  width: 40px;
  opacity: 0;
  z-index: 9;
}
.menu-btn-two input:checked ~ span:nth-child(2) {
  opacity: 0;
  transform: scale(0);
}
.menu-btn-two input:checked ~ span:nth-child(3) {
  transform: rotate(45deg);
  width: 35px;
  background: #29cda7;
  box-shadow: 0 0 2em 0.2em #29cda7;
}
.menu-btn-two input:checked ~ span:nth-child(4) {
  display: block;
  transform: rotate(135deg);
  opacity: 1;
  margin-top: -3px;
  width: 35px;
  background: #29cda7;
  box-shadow: 0 0 2em 0.2em #29cda7;
}
.menu-btn-two input:checked ~ span:nth-child(5) {
  opacity: 0;
  transform: scale(0);
}
.menu-btn-two span {
  width: 35px;
  height: 3px;
  background: #4e4e4e;
  position: relative.........完整代码请登录后点击上方下载按钮下载查看

网友评论0