css实现价格套餐卡片悬浮三维立体翻转动画效果代码
代码语言:html
所属分类:悬停
代码描述:css实现价格套餐卡片悬浮三维立体翻转动画效果代码
代码标签: css 价格 套餐 卡片 悬浮 三维 立体 翻转
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <style> @import url("https://fonts.googleapis.com/css2?family=Libre+Baskerville&family=Source+Sans+Pro:wght@400;700&display=swap"); body { margin: 0; height: 100vh; background-color: #d6d6d6; font-family: "Libre Baskerville", serif; font-family: "Source Sans Pro", sans-serif; } .container { display: flex; align-items: center; justify-content: center; flex-direction: column; height: 100vh; } .card { width: 230px; height: 325px; box-shadow: 0 3px 6px rgba(0, 0, 0, 0.16), 0 3px 6px rgba(0, 0, 0, 0.23); position: relative; perspective: 1000px; transform: perspective(1000px) translateY(0); transform-style: preserve-3d; transition: transform 0.8s ease-in-out; } .card.dark { background-color: #272727; color: #fbfbfb; } .card.dark .purchase-button { border: 1px solid indianred; } .card.light { background-color: #fbfbfb; color: #272727; } .card.light .purchase-button { border: 1px solid indianred; } .card-container { display: flex; } .card-wrapper:hover .card { transform: rotateY(179deg); z-index: 2; } .card-wrapper:hover .card .text-overlay { opacity: 0; transform-style: preserve-3d; z-index: 1; } .card-wrapper:hover .card .purchase-button-container { opacity: 1; } .text-overlay { transform: perspective(1000px) translateY(0) translateZ(80px); transition: transform 0.8s ease-in-out, opacity 1s ease; pointer-events: none; width: 100%; perspective: inherit; padding-top: 50px; } h1 { color: #272727; } h2 { font-size: 0.9rem; text-align: center; font-weight: 500; } .price { text-align: center; font-size: 1.8rem; font-weight: 900; margin: 20px; } .purchase-button-container { color: indianred; position: absolute; display: flex; justify-content: center; align-items: center; flex-direction: column; left: 0; top: 0; transform: perspective(1000px) rotateY(179deg) translateY(0) translateZ(80px); opacity: 0; z-index: -1; transition: transform 0.8s ease-in-out, opacity 1s ease; width: 100%; height: 100%; } .purchase-button-container .purchase-button { padding: 10px 40px; border-radius: 50px; font-size: 1.2rem; transition: background-color 0.25s ease, color 0.25s ease; cursor: pointer; } .purchase-button-container .purchase-button.light:hover { background-color: indianred; color: #fbfbfb; } .purchase-button-container .purchase-button.dark:hover { background-color: indianred; color: #272727; } .details-text { margin-top: 20px; display: flex; gap: 10px 10px; align-items: center; text-align: center; flex-direction: column; color: #858585; font-size: 0.75rem; } small { font-size: 0.75rem; font-weight: 100; color: #858585; } .fa-solid.........完整代码请登录后点击上方下载按钮下载查看
网友评论0