div+css实现点亮红绿灯闪烁单选效果代码
代码语言:html
所属分类:布局界面
代码描述:div+css实现点亮红绿灯闪烁单选效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width,initial-scale=1.0,maximum=1.0,minimum=1.0,user-scalable=0" /> <style> body{ padding: 100px; background: black; } * { padding: 0; margin: 0; box-sizing: border-box; } button { font-family: inherit; } .back { position: absolute; width: 16.6em; height: 6.5em; margin-top: -0.8em; margin-left: -0.77em; border-radius: 70px; box-shadow: rgba(0, 0, 0, 0.4) 0px 2px 2px, rgba(0, 0, 0, 0.3) 0px 7px 13px -3px, rgba(0, 0, 0, 0.2) 0px -1px 0px inset; background-color: #171717; z-index: -1; } .main { display: flex; } .switch { display: block; position: relative; background-color: black; width: 70px; height: 70px; box-shadow: 0 0 10px 2px rgba(0, 0, 0, 0.2), 0 0 1px 2px black, inset 0 2px 2px -2px white, inset 0 0 2px 5px #47434c, inset 0 0 2px 22px black; border-radius: 50%; padding: 20px; margin: 5px; } .switch input { display: none; } .switch input:checked + .button .light { animation: flicker 0.2s infinite 0.3s; } .switch input:checked + .button .shine { opacity: 1; } .switch input:checked + .button .shadow { opacity: 0; } .switch .button { transition: all 0.3s cubic-bezier(1, 0, 1, 1); background-color: #9b0621; width: 55px; height: 55px; border-radius: 50%; position: relative; left: -0.75em; top: -0.75em; cursor: pointer; } .switch .light { opacity: 0; animation: light-off 1s; position: absolute; width: 100%; height: 100%; background-image: radial-gradient(#ffc97e, #ff1818 40%, transparent 70%); } .switch .dots { position: absolute; width: 100%; height: 100%; background-image: radial-gradient(transparent 30%, rgba(101, 0, 0, 0.7) 70%); background-size: 10px 10px; border-radius: 50%; } @keyframes flicker { 0% { opacity: 1; } 80% { opacity: 0.8; } 100% { opacity: 1; } } @keyframes light-off { 0% { opacity: 1; } 80% { opacity: 0; } } .switch1 { display: block; position: relative; background-color: black; width: 70px; height: 70px; box-shadow: 0 0 10px 2px rgba(0, 0, 0, 0.2), 0 0 1px 2px black, inset 0 2px 2px -2px white, inset 0 0 2px 5px #47434c, inset 0 0 2px 22px black; border-radius: 50%; padding: 20px; margin: 5px; } .switch1 input { display: none; } .switch1 input:checked + .button .light { animation: flicker 0.2s infinite 0.3s; } .switch1 input:checked + .button .shine { opacity: 1; } .switch1 input:checked + .button .shadow { opacity: 0; } .switch1 .button { transition: all 0.3s cubic-bezier(1, 0, 1, 1); background-color: #9492.........完整代码请登录后点击上方下载按钮下载查看
网友评论0