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

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>3D gallery</title>
    <link rel="stylesheet" href="style.css">
</head>

<body>
    <div class="gallery">
        <div class="container">
            <div class="card card1"></div>
            <div class="card card2"></div>
            <div class="card card3"></div>
            <div class="card card4"></div>
            <div class="card card5"></div>
            <div class="card card6"></div>
        </div>
    </div>
</body>

</html>
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --i: 3;
}

.gallery {
  margin: 0 auto;
  height: 600px;
  width: 90%;
  border: 2px solid black;
  /* transform-style: preserve-3d; */
  perspective: 2000px;
  position: relative;
  z-index: 10;
  overflow: hidden;
}
.gallery::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 1);
  z-index: -1;
}

.container {
  height: 100%;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  transform-style: preserve-3d;
  animation: move 10s infinite linear;
}

.card {
  height: 300px;
  width: 300px;
  position: absolute;
  background-size: cover;
  background-position: center;
  -webkit-box-reflect: below 10px
    linear-gradient(rgba(255, 255, 255, 0.226), rgba(255, 255, 255, 0.151));
}

.card1 {
  background-image: url("https://picsum.photos/400");
  transform: rotateY(60deg) translateZ(600px);
}
.card2 {
  background-image: url("https://picsum.photos/450");
  transform: rotateY(120deg) translateZ(600px);
}
.card3 {
  background-image: url("https://picsum.photos/500");
  transform: rotateY(180deg) translateZ(600px);
}
.card4 {
  background-image: url("https://picsum.photos/430");
  transform: rotateY(240deg) translateZ(600px);
}
.card5 {
  background-image: url("https://picsum.photos/420");
  transform: rotateY(300deg) translateZ(600px);
}
.card6 {
  background-image: url("https://picsum.photos/410");
  transform: rotateY(360deg) translateZ(600px);
}

@keyframes move {
  to {
    transform: rotateY(360deg);
  }
}

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.