div+css实现立体wifi开关按钮点击效果代码

代码语言:html

所属分类:布局界面

代码描述:div+css实现立体wifi开关按钮点击效果代码

代码标签: div css 立体 wifi 开关 按钮 点击

下面为部分代码预览,完整代码请点击下载或在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" />

     <style>
     body{
         margin: 100px;
         background: #212121;
     }
     .container {
  width: 7em;
  height: 7em;
  position: relative;
}

.button {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 4px solid #090909;
  background-color: transparent;
  background-image: linear-gradient(145deg, #171717, #444245);
  box-sizing: border-box;
  box-shadow: inset 2px 2px 0 #7d7c7e, inset -2px -2px 0px #1c1c1c;
  display: flex;
  align-items: center;
  justify-content: center;
}

.container input {
  display: none;
}

.button::before {
  position: absolute;
  content: "";
  width: 7.25em;
  height: 7.25em;
  border-radius: inherit;
  background-color: transparent;
  background-image: linear-gradient(145deg, #262626, #606060);
  z-index: -1;
  box-shadow: 11px 11px 22px #141414, -11px -11px 22px #525252;
}

.button .icon {
  width: 60px;
  height: 60px;
  display: inline-block;
}

.button .icon svg {
  height: 100%;
  width: 100%;
  fill: #a5a5a5;
}

.container  input:checked + .button {
  box-shadow: inset -2px -2px 0 #5e5e5e,inset 2px 2px 0 #1c1c1c;
  border: 4px solid rgba(77, 124, 255, 0.281);
  animation: animeBorder .3s linear alternate-reverse infinite;
}

.container input:checked + .button .icon svg {
  fill: rgb(77, 124, 255);
  animation: animeFill .3s linear alternate-reverse infinite;
}

@keyframes animeFill {
  to {
    fill: rgba(77, 124, 255, 0.642);
  }
}

@keyframes animeBorder {
  to {
    border-color: rgba(77, 124, 255, 0.137);
  }
}
      </style>
</head>
<body>
   <div class="container">
  <input id="checkbox" type="checkbox">
   <label class="button" for="checkbox">
    <span class="icon">
     <svg viewBox="0 0 24 24" fill="" xmlns="http://www.w3.org/2000/svg"><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g><g id="SVGRepo_iconCarrier"> <path d="M17.35 12.7901C17.1686 12.7907 16.9935 12.7229 16.86 12.6001C15.5322 11.411 13.8124 10.7534 12.03 10.7534C10.2476 10.7534 8.52779 11.411 7.19999 12.6001C7.12649 12.6658 7.04075 12.7164 6.94767 12.749C6.85459 12.7816 6.756 12.7955 6.65755 12.7899C6.55909 12.7843 6.4627 12..........完整代码请登录后点击上方下载按钮下载查看

网友评论0