css+div实现悬浮放大的照片墙效果代码

代码语言:html

所属分类:画廊相册

代码描述:css+div实现悬浮放大的照片墙效果代码

代码标签: css div 悬浮 放大 照片墙

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html lang="en" >

<head>
  <meta charset="UTF-8">
  

  
  
  
<style>
body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  place-content: center;
  background: #000;
  line-height: 1em;
}

    h1 {
  text-align: center;
  color:rgb(212, 208, 208);
  font-size: 28px;
}

h3 {
  text-align: center;
  color:rgb(212, 208, 208);
  font-size: 22px;
}

.gallery {
  --s: 150px; /* control the size */
  --g: 10px;  /* control the gap */
  --f: 1.5;   /* control the scale factor */
  display: grid;
  gap: var(--g);
  width: calc(3*var(--s) + 2*var(--g));
  aspect-ratio: 1;
  grid-template-columns: repeat(3,auto);
  animation: slide-in 1s ;
}

.gallery > img {
  width: 0;
  height: 0;
  min-height: 100%;
  min-width: 100%;
  object-fit: cover;
  cursor: pointer;
  filter: grayscale(80%);
  transition: .35s linear;
}

.gallery img:hover{
  filter: grayscale(0);
  width:  calc(var(--s)*var(--f));
  height: calc(var(--s)*var(--f));
}

/****************************************/

@keyframes slide-in {
  0% {
    transform: translate(-100%, -100%);
  }
  100% {
    transform: translate(0, 0);
  }
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.img-a, .img-b, .img-c, .img-d, .img-e, .img-f, .img-g, .img-h, .img-i {
  animation-name:spin;
  animation-timing-function: linear;
  animation:ease-in-out, spin 1s linear;
 }
 
#top-left-a {
  top: 0;
  left: 0;

}

#top-left-b {
  top: 0;
  left: 0;
  animation-delay: 2s;
}


#top-right-a {
  top: 0;
  right: 0;
  animation-delay: 1s;
}

#top-right-b {
  top: 0;
  right: 0;
  animation-delay: 2s;
}

#middle {
  top: 0;
  right: 0;
  animation-delay: 1s;
}

#bottom-left-a {
  bottom: 0;
  left: 0;
  animation-delay: 2s;
}

#bottom-left-b {
  bottom: 0;
  left: 0;
  animation-delay: 1s;
}

#bottom-right-a {
  bottom: 0;
  right: 0;
  animation-delay: 2s;
}

#bottom-right-b {
  bottom: 0;
  right: 0;
  animation-delay: 1s;
}
</style>

  
  
</head>

<body >
  <h1>Expanding Image Gallery CSS</h1.........完整代码请登录后点击上方下载按钮下载查看

网友评论0