css布局实现中性开关效果代码
代码语言:html
所属分类:布局界面
代码描述:css布局实现中性开关效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <style> body { display: flex; align-items: center; justify-content: center; height: 100vh; background-color: #e8e8e8; } .switch { position: relative; display: inline-block; width: 80px; height: 80px; border: 2px solid #dcdcdc; background: #e0e0e0; box-shadow: 7px 7px 23px #bebebe, -7px -7px 23px #ffffff; overflow: hidden; border-radius: 60px; } .switch input { opacity: 0; width: 0; height: 0; } .slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; -webkit-transition: 0.5s; transition: 0.5s; } input:checked + .slider:before { background: white; box-shadow: none; } input:focus + .slider { box-shadow: 0 0 1px #2196f3; } .slider { color: #9a9a9a; display: flex; align-items: center; justify-content: center; font-size: 11px; font-family: sans-serif; } .slider--0 { color: white; font-weight: 600; background-color: #49d84e; } .slider--1 div { transition: 0.5s; } .slider--1 div { position: absolute; width: 100%; height: 50%; left: 0; } input:checked ~ .slider--1 div:first-child { transform: translateY(-100%); transition-delay: 1s; } input:.........完整代码请登录后点击上方下载按钮下载查看
网友评论0