div+css实现立体翻折checkbox开关点击切换效果代码
代码语言:html
所属分类:布局界面
代码描述:div+css实现立体翻折checkbox开关点击切换效果代码
代码标签: div css 立体 翻折 checkbox 开关 点击 切换
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="zh-CN"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no"> <style> * { margin: 0; padding: 0; /* 解决手机浏览器点击有选框的问题 */ -webkit-tap-highlight-color: rgba(0, 0, 0, 0); } body { display: flex; justify-content: center; align-items: center; overflow: hidden; min-height: 100vh; background-color: #ddd; } .box { width: 300px; height: 120px; border: 5px solid #000; border-radius: 120px; position: relative; transform-style: preserve-3d; perspective: 500px; } .box input[type="checkbox"] { width: 100%; height: 100%; outline: none; cursor: pointer; -webkit-appearance: none; position: absolute; transition: 0.5s; } .box span { width: 50%; height: 100%; line-height: 120px; text-align: center; color: #fff; font-size: 3em; font-weight: bold; text-transform: uppercase; pointer-events: none; position: absolute; top: 0; transform-style: preserve-3d; perspective: 500px; } .box span:nth-child(2) { left: 0; border-radius: 120px 0 0 120px; background-color: #0f0; } .box span:nth-child(2)::before { content: ""; width: 100%; height: 100%; .........完整代码请登录后点击上方下载按钮下载查看
网友评论0