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=Basic&family=Poppins&display=swap");

:root {
  --background: #3c343d;
  --background-border: #6b626c;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: Poppins;
  height: 100vh;
  padding: 32px;
  display: grid;
  place-items: center;
  background-color: var(--background);
}

.gallery {
  display: flex;
  background-color: var(--background);
  gap: 16px;
  scale: 1.6;
}

.card {
  position: relative;
  left: 0px;
  width: 140px;
  height: 160px;
  background-color: var(--background);
  border-radius: 8px;
  transition: 1000ms all;
  transform-origin: center left;
  box-shadow: 0 5px 12px rgba(0, 0, 0, 0.5);
  outline: 1px solid var(--background);
  overflow: hidden;
}

.card img {
  height: 160px;
  object-fit: cover;
  border-radius: 4px;
}

.card:hover {
  cursor: pointer;
  transform: scale(1.15);
}

.card:hover figcaption {
  font-size: 0.6rem;
  position: absolute;
  height: 80px;
  width: 160px;
  display: flex;
  align-items: end;
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.9) 0%,
    rgba(0.........完整代码请登录后点击上方下载按钮下载查看

网友评论0