卡片悬浮弹出标题及菜单效果
代码语言:html
所属分类:悬停
代码描述:卡片悬浮弹出标题及菜单效果
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <link type="text/css" rel="stylesheet" href="http://repo.bfw.wiki/bfwrepo/css/all.min.css"> <style> *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; } body { width: 100%; height: 100vh; display: flex; justify-content: center; align-items: center; background: #e4e4e4; } .container { display: grid; grid-template-rows: repeat(2, 1fr); grid-template-columns: repeat(2, 1fr); grid-gap: 30px; } figure.card { position: relative; width: 380px; height: 240px; background-image: var(--image-src); background-position: 50% 50%; background-size: 125%; transition: background 400ms ease; box-shadow: 0 6.7px 5.3px rgba(0, 0, 0, 0.03), 0 22.3px 17.9px rgba(0, 0, 0, 0.05), 0 100px 80px rgba(0, 0, 0, 0.07); overflow: hidden; } figure.card:hover figcaption { transform: translateY(0px); } figure.card--1:hover { background-position: 50% 100%; } figure.card--1 figcaption { bottom: 0; transform: translateY(80px); } figure.card--2 { background-size: 110%; } figure.card--2:hover { background-position: 50% -100%; } figure.card--2 figcaption { top: 0; transform: translateY(-80px); } figure.card--3 { background-size: 115%; } figure.card--3:hover { background-position: -100% 50%; } figure.card--3 figcaption { left: 0; transform: translateX(-180px); } figure.card--4:hover { background-position: 100% 50%; } figure.card--4 figcaption { right: 0; transform: translateX(180px); } figure.card--1 figcaption, figure.card--2 figcaption { width: 100%; height: 80px; padding: 15px 20px; } figure.card--3 figcaption, figure.card--4 figcaption { flex-direction: column; width: 180px; height: 100%; padding: 20px 15px; } figure.card figcaption { display: flex; justify-content: space-between; align-items: center; position: absolute; background: #282828; transition: transform 400ms ease; } figure.card figcaption .info { color: #e2e2e2; font-family: "Montserrat"; } figure.card figcaption .info h3 { font-size: 1.2rem; .........完整代码请登录后点击上方下载按钮下载查看
网友评论0