css模拟物理键盘按键按下弹出动画效果
代码语言:html
所属分类:布局界面
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <style> @import url("https://fonts.googleapis.com/css?family=Roboto&display=swap"); * { box-sizing: border-box; } html, body { height: 100%; } body { display: flex; flex-direction: column; justify-content: center; align-items: center; font-family: "Roboto", sans-serif; background-color: #f4f5f6; font-size: 14px; color: #666666; } .button { position: relative; padding: 0; width: 200px; height: 200px; border: 4px solid #888888; outline: none; background-color: #f4f5f6; border-radius: 40px; box-shadow: -6px -20px 35px #ffffff, -6px -10px 15px #ffffff, -20px 0px 30px #ffffff, 6px 20px 25px rgba(0, 0, 0, 0.2); transition: .2s ease-in-out; cursor: pointer; } .button:active { box-shadow: none; } .button:active .button__content { box-shadow: none; } .button:active .button__content .button__text, .button:active .button__content .button__icon { transform: translate3d(0px, 0px, 0px); } .button__content { position: relative; display: grid; padding: 20px; width: 100%; height: 100%; grid-template-columns: 1fr 1fr 1fr 1fr; grid-template-rows: 1fr 1fr; box-shadow: inset 0px -8px 0px #dddddd, 0px -8px 0px #f4f5f6; border-radius: 40px; transition: .2s ease-in-out; z-index: 1; } .button__icon { position: relative; display: flex; transform: translate3d(0px, -4px, 0px); grid-column: 4; align-self: start; justify-self: end; width: 32px; height: 32px; transition: .2s ease-in-out; } .button__icon svg { width: 32px; height: 32px; fill: #aaaaaa; } .button__text { position: relative; transform: translate3d(0px, -4px, 0px); margin: 0; align-self: end; grid-column: 1/5; grid-row: 2; text-align: center; font-size: 32px; background-color: #888888; color: transparent; text-shadow: 2px 2px 3px rgba(255, 255, 255, 0.5); -webkit-background-clip: text; -moz-background-clip: text; background-clip: text; transition: .2s ease-in-out; } .credits { margin-top: 24px;.........完整代码请登录后点击上方下载按钮下载查看
网友评论0