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-child(5) {
          --top: 20%;
          --light: 76%;
          --tDelay: 0.16s;
        }
        .radioPole_layers > div:nth-child(6) {
          --top: 25%;
          --light: 75%;
          --tDelay: 0.15s;
        }
        .radioPole_layers > div:nth-child(7) {
          --top: 30%;
          --light: 74%;
          --tDelay: 0.14s;
        }
        .radioPole_layers > div:nth-child(8) {
          --top: 35%;
          --light: 73%;
          --tDelay: 0.13s;
        }
        .radioPole_layers > div:nth-child(9) {
          --top: 40%;
          --light: 72%;
          --tDelay: 0.12s;
        }
        .radioPole_layers > div:nth-child(10) {
          --top: 45%;
          --light: 71%;
          --tDelay: 0.11s;
        }
        .radioPole_layers > div:nth-child(11) {
          --top: 50%;
          --light: 70%;
          --tDelay: 0.1s;
        }
        .radioPole_layers > div:nth-child(12) {
          --top: 55%;
          --light: 69%;
          --tDelay: 0.09s;
        }
        .radioPole_layers > div:nth-child(13) {
          --top: 60%;
          --light: 68%;
          --tDelay: 0.08s;
        }
        .radioPole_layers > div:nth-child(14) {
          --top: 65%;
          --light: 67%;
          --tDelay: 0.07s;
        }
        .radioPole_layers > div:nth-child(15) {
          --top: 70%;
          --light: 66%;
          --tDelay: 0.06s;
        }
        .radioPole_layers > div:nth-child(16) {
          --top: 75%;
          --light: 65%;
          --tDelay: 0.05s;
        }
        .radioPole_layers > div:nth-child(17) {
          --top: 80%;
          --light: 64%;
          --tDelay: 0.04s;
        }
        .radioPole_layers > div.........完整代码请登录后点击上方下载按钮下载查看

网友评论0