div+css实现具有伸缩回弹效果的checkbox开关美化代码
代码语言:html
所属分类:布局界面
代码描述:div+css实现具有伸缩回弹效果的checkbox开关美化代码
代码标签: div css 伸缩 回弹 checkbox 开关 美化 代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <style> :root { --magic-ease: linear( 0, 0.0039, 0.0157, 0.0352, 0.0625 9.09%, 0.1407, 0.25, 0.3908, 0.5625, 0.7654, 1, 0.8907, 0.8125 45.45%, 0.7852, 0.7657, 0.7539, 0.75, 0.7539, 0.7657, 0.7852, 0.8125 63.64%, 0.8905, 1 72.73%, 0.9727, 0.9532, 0.9414, 0.9375, 0.9414, 0.9531, 0.9726, 1, 0.9883, 0.9844, 0.9883, 1 ); --default: hsl(0 0% 50%); --active: hsl(140 80% 50%); --bg: hsl(0 0% 0%); --ar: 2.5 / 1; } *, *::after { box-sizing: border-box; } body { display: grid; place-items: center; min-height: 100vh; background: hsl(0 0% 4%); } .sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border-width: 0; } .toggle { height: 60px; aspect-ratio: var(--ar); background: var(--bg); border-radius: 100px; display: inline-block; container-type: size; position: relative; cursor: pointer; border: 1px solid hsl(0 0% 45%); box-shadow: 0 1px inset white, 0 4px 10px -5px black; overflow: hidden; } .toggle::before { content: ""; position: absolute; inset: 0; background: linear-gradient(172deg, hsl(0 0% 100% / 0.18) 40%, transparent 45%); z-index: 2; .........完整代码请登录后点击上方下载按钮下载查看
网友评论0