checkbox带窗帘效果的明暗模式切换效果
代码语言:html
所属分类:表单美化
代码描述:checkbox带窗帘效果的明暗模式切换效果
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <style> * { border: 0; box-sizing: border-box; margin: 0; padding: 0; } :root { --dur: 0.3s; font-size: calc(40px + (80 - 40)*(100vw - 320px)/(2560 - 320)); } body, input { color: hsl(0,0%,10%); font: 1em/1.5 sans-serif; } form, .toggle:before, .toggle:after { background: hsl(0,0%,90%); } form, .toggle { position: relative; } form { display: flex; justify-content: center; align-items: center; height: 100vh; } .curtain, .sr, .toggle:before, .toggle:after { position: absolute; } .curtain, .toggle:before, .toggle:after { transition: transform var(--dur); } .curtain, .toggle:before, .toggle:checked:after { transition-timing-function: ease-out; } .curtain, .sr { top: 0; left: 0; } .curtain { background: hsl(0,0%,100%); mix-blend-mode: difference; pointer-events: none; width: 100%; height: 100%; transform: scaleX(0); transform-origin: 0 50%; } .sr, .toggle { overflow: hidden; } .sr { clip: rect(1px,1px,1px,1px); color: transparent; width: 1px; height: 1px; } .toggle { background: currentColor; border-radius: 0.........完整代码请登录后点击上方下载按钮下载查看
网友评论0