css实现checkbox美化箭头开关效果代码

代码语言:html

所属分类:表单美化

代码描述:css实现checkbox美化箭头开关效果代码

代码标签: css checkbox 美化 箭头 开关

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


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

<head>

  <meta charset="UTF-8">
  
<link type="text/css" rel="stylesheet" href="//repo.bfw.wiki/bfwrepo/css/all.6.1.2.css">
  
  
  
<style>
*,
*::after,
*::before {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background-color: hsl(188deg 3% 83%);
}

:root {
    --container: 16rem;
    --height: 5.125rem;
    --ball: 4.25rem;
}

[type="checkbox"] {
    appearance: none;
    display: none;
}

.checkbox__container {
    transform: scale(1.2);
    display: grid;
    inline-size: var(--container);
    block-size: var(--height);
    border-radius: 100vh;
    background: linear-gradient(45deg, hsl(39, 100%, 80%), hsl(300, 47%, 85%));
    position: relative;
    box-shadow: 0px 1.9px 3.2px rgba(0, 0, 0, 0.25);
    outline: 1px solid hsl(0, 0%, 60%, 0.2);
}

.label-for-toggle {
    cursor: pointer;
    isolation: isolate;
    display: grid;
    place-content: center start;
    width: inherit;
    border-radius: inherit;
    border: 16px solid hsl(200, 0%, 100%, 0.8.........完整代码请登录后点击上方下载按钮下载查看

网友评论0