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{ background: black; margin: 200px; } .container input { position: absolute; opacity: 0; cursor: pointer; height: 0; width: 0; } .container { display: flex; flex-direction: column; align-items: center; position: relative; cursor: pointer; user-select: none; } .simple-text { position: absolute; bottom: -40px; width: 120px; text-align: center; color: white; font-size: 16pt; font-weight: 800; font-family: monospace; } .torch { display: flex; justify-content: center; height: 150px; } .head, .stick { position: absolute; width: 30px; transform-style: preserve-3d; transform: rotateX(-30deg) rotateY(45deg); } .stick { position: relative; height: 120px; } .face { position: absolute; transform-style: preserve-3d; width: 30px; height: 30px; display: grid; grid-template-columns: 50% 50%; grid-template-rows: 50% 50%; background-color: #000000; } .top { transform: rotateX(90deg) translateZ(15px); } .left { transform: rotateY(-90deg) translateZ(15px); } .right { transform: rotateY(0deg) translateZ(15px); } .top div, .left div, .right div { width: 102%; height: 102%; } .top div:nth-child(1), .left div:nth-child(3), .right div:nth-child(3) { background-color: #ffff9760; } .top div:nth-child(2), .left div:nth-child(1), .right div:nth-child(1) { background-color: #ffd80060; } .top div:nth-child(3), .left div:nth-child(4), .right div:nth-child(4) { background-color: #ffffff60; } .top div:nth-child(4), .left div:nth-child(2), .right div:nth-child(2) { background-color: #ff8f0060; } .side { position: absolute; width: 30px; height: 120px; display: grid; grid-template-columns: 50% 50%; grid-template-rows: repeat(8, 12.5%); cursor: pointer; translate: 0 12px; } .side-left { transform: rotateY(-90deg) translateZ(15px) translateY(8px); } .side-right { transform: rotateY(0deg) translateZ(15px) translateY(8px); } .side-left div, .side-right div { width: 103%; height: 103%; } .side div:nth-child(1) { background-color: #443622; } .side div:nth-child(2), .side div:nth-child(2) { background-color: #2e2517; } .side div:nth-child(3), .side div:nth-child(5) { background-color: #4b3b23; } .side div:nth-child(4), .side div:nth-child(10) { background-color: #251e12; } .side div:nth-child(6) { background-color: #292115; } .side div:nth-child(7) { background-color: #4b3c26; } .side div:nth-child(8) { background-color: #292115; } .side div:nth-child(9) { background-color: #4b3a21; } .side div:nth-child(11), .side div:nth-child(15) { background-color: #3d311d; } .side div:nth-child(12) { background-color: #2c2315; } .side div:nth-child(13) { background-color: #493a22; } .side div:nth-child(14) { background-color: #2b2114; } .side div:nth-child(16) { background-color: #271e10; } .container input:checked ~ .torch .face { filter: drop-shadow(0px 0px 2px rgb(255, 255, 255)) drop-shadow(0px 0px 10px rgba(255, 237, 156, 0.7)) drop-shadow(0px 0px 25px rgba(255, 227, 101, 0.4)); } .container input:checked ~ .torch .top div:nth-child(1), .container input:checked ~ .torch .left div:nth-child(3), .container input:checked ~ .torch .right div:nth-child(3) { background-color: #ffff97; } .container input:checked ~ .torch .top div:nth-child(2), .container input:checked ~ .torch .left div:nth-child(1), .container input:checked ~ .torch .right div:nth-child(1) { background-color: #ffd800; } .container input:checked ~ .torch .top div:nth-child(3), .container input:checked ~ .torch .left div:nth-child(4), .container input:checked ~ .torch .right div:nth.........完整代码请登录后点击上方下载按钮下载查看
网友评论0