纯css实现3d滚球开关效果
代码语言:html
所属分类:表单美化
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title> Toy Toggle Switch</title> <meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover"> <style> *, *:before, *:after { border: 0; box-sizing: border-box; margin: 0; padding: 0; } body { background: linear-gradient(#fff,#ccc); display: flex; height: 100vh; --on: #88e661; --off: #f0f0f0; --transDur: 0.6s; } input { position: fixed; transform: translateX(-100%); } .toy-toggle { background: radial-gradient(attop left,#fff 10%,#fff0 20%), radial-gradient(at top right,#fff 20%,#e4e4e4 35%); border-radius: 6em; box-shadow: 0 0 0.25em #0002, 0 3em 1.5em 0.5em #0002; cursor: pointer; display: block; font-size: 12px; position: relative; margin: auto; width: 20em; height: 12em; -webkit-tap-highlight-color: transparent; } .toy-toggle div { position: absolute; } .toy-toggle > div { top: 50%; left: 50%; } .toy-toggle > div:not(.handle) { transform: translate(-50%,-50%); } .border1 { background: #f0f0f0; border-radius: 5.5em; box-shadow: 0 0 0.2em 0.1em #f0f0f0; width: 19em; height: 11em; } .border2 { background.........完整代码请登录后点击上方下载按钮下载查看
网友评论0