css实现悬浮刷卡交易动画
代码语言:html
所属分类:悬停
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <style> @import url("https://fonts.googleapis.com/css?family=Lexend+Deca&display=swap"); :root { --background: #33837e; --left-side: #5de2a3; --card: #c7ffbc; --card-line: #80ea69; --button-color-3: #26850e; --button-color-2: #379e1f; --button-color-1: #56be3e; --post: #dddde0; --numbers: #838183; --numbers-2: #aaa9ab; --post-line: #757375; --post-line2: #545354; --dollar: #4b953b; } html { box-sizing: border-box; -webkit-font-smoothing: antialiased; } body { min-height: 100vh; display: flex; justify-content: center; align-items: center; overflow: hidden; width: 100%; background: var(--background); } .container { background-color: #ffffff; display: flex; width: 460px; height: 120px; position: relative; border-radius: 6px; transition: 0.3s ease-in-out; } .container:before { width: 200vw; position: absolute; top: 0; left: -100vw; height: 100%; content: ""; } .container:hover { transform: scale(1.03); width: 220px; } .container:hover .left-side { width: 100%; } .left-side { background-color: var(--left-side); width: 130px; height: 120px; border-radius: 4px; position: relative; display: flex; justify-content: center; align-items: center; cursor: pointer; transition: 0.3s; flex-shrink: 0; overflow: hidden; } .right-side { width: calc(100% - 130px); display: flex; align-items: center; overflow: hidden; cursor: pointer; justify-content: space-between; white-space: nowrap; transition: 0.3s; } .right-side:hover { background-color: #f9f7f9; } .arrow { width: 20px; height: 20px; margin-right: 20px; } .new { font-size: 23px; font-family: "Lexend Deca", sans-serif; margin-left: 20px; } .card { width: 70px; height: 46px; background-color: var(--card); border-radius: 6px; position: absolute; display: flex; z-index: 10; flex-direction: column; align-items: center; -webkit-box-shadow: 9px 9px 9px -2px rgba(77, 200, 143, 0.72); -moz-box-shadow: 9px 9px 9px -2px rgba(77, 200, 143, 0.72); box-shadow: 9px 9px 9px -2px rgba(77, 200, 143, 0.72); } .card-line { width: 65px; height: 13px; background-color: var(--card-line); border-radius: 2px; margin-top: 7px; } @media only screen and (max-width: 480px) { .container { transform: scale(0.7); } .container:hover { transform: scale(0.74); } .new { font-size: 18px; } } .buttons { width: 8px; height: 8px; background-color: var(--button-color-2); box-shadow: 0 -10px 0 0 var(--button-color-3), 0 10px 0 0 var(--button-color-1); border-radius: 50%; margin-top: 5px; transform: rotate(90deg); margin: 10px 0 0 -30px; } .container:hover .card { animation: slide-top 1.2s cubic-bezier(0.645, 0.045, 0.355, 1) both; } .container:hover .post { animation: slide-post 1s cubic-bezier(0.165, 0.84, 0.44, 1) both; } @keyframes slide-top { 0% { -webkit-transform: translateY(0); transform: translateY(0); } 50% { -webkit-transform: translateY(-70px) rotate(90deg); transform: translateY(-70px) rotate(90deg); } 60% { -webkit-transform: translateY(-70px) .........完整代码请登录后点击上方下载按钮下载查看
网友评论0