css美化radio成磁极圆柱效果代码

代码语言:html

所属分类:表单美化

代码描述:css美化radio成磁极圆柱效果代码

代码标签: 磁极 圆柱 效果

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

<!DOCTYPE html>

<html lang="en">

<head>

   
<meta charset="UTF-8">





   
<style>
        @import url("https://fonts.googleapis.com/css2?family=Ubuntu:wght@400;700&display=swap");
        *, *::before, *::after {
          padding: 0;
          margin: 0 auto;
          box-sizing: border-box;
        }
       
        *, *::before, *::after {
          box-sizing: border-box;
        }
       
        body {
          font-family: "Ubuntu", sans-serif;
          background-color: white;
          color: #000;
          min-height: 100vh;
          margin: 0;
          padding: 3em 1em;
          display: grid;
          place-items: center;
          perspective: 6em;
        }
       
        *:not(:empty) {
          transform-style: preserve-3d;
        }
       
        .radioPole {
          position: relative;
          display: block;
          cursor: pointer;
          -webkit-user-select: none;
             -moz-user-select: none;
              -ms-user-select: none;
                  user-select: none;
        }
        .radioPole:active > .radioPole_layers {
          height: 0.25em;
        }
        .radioPole_label {
          padding: 0.25em 0.25em 0.25em 1.5em;
        }
        .radioPole > input {
          -webkit-appearance: none;
             -moz-appearance: none;
                  appearance: none;
          position: fixed;
          left: -100vmax;
          top: -100vmax;
        }
        .radioPole > input:checked ~ .radioPole_layers {
          --saturation: 100%;
          --checkLight: -40%;
        }
        .radioPole > input:disabled ~ * {
          cursor: not-allowed;
        }
        .radioPole > input:disabled ~ .radioPole_layers {
          height: 0;
        }
        .radioPole > input:disabled ~ .radioPole_layers > div {
          --light: 75%;
          box-shadow: none;
        }
        .radioPole > input:disabled ~ .radioPole_layers > div:nth-child(n+2) {
          display: none;
        }
        .radioPole > input:focus-visible ~ .radioPole_label {
          outline: 1px #000 solid;
        }
        .radioPole_layers {
          position: absolute;
          left: 0.25em;
          bottom: 50%;
          width: 1em;
          height: 1em;
          transform: rotateX(-90deg);
          transform-origin: bottom;
          transition: height 0.25s;
        }
        .radioPole_layers > div {
          position: absolute;
          left: 0;
          top: var(--top, 0);
          width: 1em;
          height: 1em;
          border-radius: 50%;
          background-color: hsl(var(--hue, 120), var(--saturation, 0%), calc(var(--light) + var(--checkLight, 0%)));
          transform: translateY(-50%) rotateX(90deg);
          transition: background-color 0.5s var(--tDelay, 0s);
        }
        .radioPole_layers > div:nth-child(1) {
          --top: 0%;
          --light: 80%;
          --tDelay: 0.2s;
        }
        .radioPole_layers > div:nth-child(2) {
          --top: 5%;
          --light: 79%;
          --tDelay: 0.19s;
        }
        .radioPole_layers > div:nth-child(3) {
          --top: 10%;
          --light: 78%;
          --tDelay: 0.18s;
        }
        .radioPole_layers > div:nth-child(4) {
          --top: 15%;
          --light: 77%;
          --tDelay: 0.17s;
        }
        .radioPole_layers > div:nth-c.........完整代码请登录后点击上方下载按钮下载查看

网友评论0