css美化checkbox实现立体质感开关切换效果代码
代码语言:html
所属分类:表单美化
代码描述:css美化checkbox实现立体质感开关切换效果代码
代码标签: css 美化 checkbox 立体 质感 开关 切换
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <style> body { display: grid; margin: 0; place-items: center; min-height: 100vh; font-size: 15vmin; background: #ccc; } .circle { --c: #333; appearance: none; position: relative; box-sizing: content-box; font-size: 1em; height: 1em; aspect-ratio: 2; border: max(1px, 0.025em) solid var(--c); border-radius: 1em; background: linear-gradient(#0003, #0000) 85% 50% / 23% 10%, linear-gradient(#777 0 0) 85% 50% / 23% 10%, linear-gradient(#0002 0 0), var(--c) ; background-repeat: no-repeat; box-shadow: 0.05em 0.05em 0.1em #0002, inset 0 0 0.05em -0.025em #fff5, inset 0 0 0.2em #0002; &::before { content: ""; position: absolute; top: 50%; left: 0.5em; transform: translate(-50%, -50%); height: 50%; aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle at 50% 50%, var(--c) calc(0.17em - 1px), #0000 0.17em), radial-gradient(circle at 53% 53%, var(--c) 0.1em, #0000 0.18em), #eee; box-shadow: inset .........完整代码请登录后点击上方下载按钮下载查看
网友评论0