css实现checkbox三维小球滑动立体开关效果代码

代码语言:html

所属分类:表单美化

代码描述:css实现checkbox三维小球滑动立体开关效果代码

代码标签: css checkbox 三维 小球 滑动 立体 开关

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

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

<head>
    <meta charset="UTF-8">
    <style>
        body {
          display: flex;
          align-items: center;
          justify-content: center;
          margin: 0;
          height: 100vh;
          perspective-origin: calc(50% + 10rem) calc(50% - 10rem);
          perspective: 32em;
          background: radial-gradient(#e5e5e5, #ddd);
        }
        
        [type=checkbox] {
          position: absolute;
          left: -100vw;
        }
        [type=checkbox] + label {
          --s: 0;
          position: relative;
          border: solid 0.625rem #f0f0f0;
          width: 10rem;
          height: 5rem;
          border-radius: 5rem;
          transform-style: preserve-3d;
          transform: rotatex(90deg) rotate(22.5deg) rotatey(22.5deg);
          box-shadow: 0.5rem 0.875rem 0 -0.25rem #e0e0e0, 0.625rem 0.625rem 0 -0.25rem #e0e0e0, 0.5rem 0.875rem 0.625rem -0.125rem rgba(191, 191, 191, 0.75), inset 0.125rem -0.125rem 0.5rem rgba(245, 245, 245, 0.5), inset 0.75rem 0.75rem #dfdfdf, inset 0.75rem 0.75rem 0.75rem rgba(191, 191, 191, 0.85), inset 0 1rem 0.75rem rgba(191, 191, 191, 0.65);
          color: transparent;
          font-size: 0;
          -webkit-tap-highlight-color: transparent;
          cursor: pointer;
        }
        [type=checkbox] + label:before, [type.........完整代码请登录后点击上方下载按钮下载查看

网友评论0