div+css实现图片卡片悬浮文字弹出动画效果代码
代码语言:html
所属分类:悬停
代码描述:div+css实现图片卡片悬浮文字弹出动画效果代码
代码标签: div css 图片 卡片 悬浮 文字 弹出 动画
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <style> @import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;800;900&display=swap'); *{ margin: 0; padding: 0; font-family: 'Poppins', sans-serif; } :root { --d: 700ms; --e: cubic-bezier(0.19, 1, 0.22, 1); } body{ display: flex; justify-content: center; align-items: center; min-height: 100vh; background-image: radial-gradient( circle farthest-corner at 1.3% 2.8%, rgba(239,249,249,1) 0%, rgba(182,199,226,1) 100.2% );} .container { display: flex; justify-content: center; align-items: center; justify-content: space-around; width: 1100px; } .card { position: relative; display: flex; align-items: flex-end; width: 100%; height: 100%; color: whitesmoke; cursor: pointer; overflow: hidden; z-index: 10; pointer-events: auto; } .card-border { position: relative; width: 320px; height: 460px; z-index: 9; pointer-events: none; } .card-border:after, .card-border:before { content: ""; left: -20px; bottom: -20px; right:-20px; top: -20px; position: absolute; transition: transform 0.3s ease-in-out; } .card-border:before { transform: scaleY(0); } .card-border:after { transform: scaleX(0); } .card-border:nth-child(1) .card{ background-image: url(//repo.bfw.wiki/bfwrepo/image/5e0c2125c1f55.png?x-oss-process=image/auto-orient,1/resize,m_fill,w_320,h_460,/quality,q_90); } .card-border:nth-child(2) .card{ background-image: url(//repo.bfw.wiki/bfwrepo/image/62c3707145c64.png?x-oss-process=image/auto-orient,1/resize,m_fill,w_320,h_460,/quality,q_90); } .card-border:nth-child(3) .card{ background-image: url(//repo.bfw.wiki/bfwrepo/image/6032e430d8edb.png?x-oss-process=image/auto-orient,1/resize,m_fill,w_320,h_460,/quality,q_90); } .card-border:nth-child(1):before { border-left: 6px solid #241f57; border-right: 6px solid #241f57; } .card-border:nth-child(1):after { border-bottom: 6px solid #241f57; border-top: 6px solid #241f57; } .card-border:nth-child(2):before { border-left: 6px solid #6aa6d8; border-right: 6px solid #6aa6d8; } .card-border:nth-child(2):after { border-bottom: 6px solid #6aa6d8; border-top: 6px solid #6aa6d8; } .card-border:nth-child(3):before { border-left: 6px solid #759554; border-right: 6px solid #759554; } .card-border:nth-child(3):after { border-bottom: 6px solid #759554; border-top: 6px solid #759554; } .card-border:hover:before { transform: scaleY(1); } .card-border:hover:after { transform: scaleX(1); } .content { position: relative; display: flex; flex-direction: column; align-items: center; width: 100%; padding: 1rem; transition: transform var(--d) var(--e); z-index: 1; } .content { transform: translateY(calc(100% - 4.5rem)); } .card-border:nth-child(2) .content { transform: translateY(calc(100% - 6.5rem)); } .card-border:nth-child(3) .content .........完整代码请登录后点击上方下载按钮下载查看
网友评论0