📝 代码查看
使用runcode.html页面

1
查看次数
2025-11-07
创建时间
2025-11-07
最后更新
<div class="g-container">
  <div class="g-section">CSS Parallax</div>
  <div class="g-section">CSS Parallax</div>
  <div class="g-section">CSS Parallax</div>
  <div class="g-section">CSS Parallax</div>
  <div class="g-section">CSS Parallax</div>
  <div class="g-section">CSS Parallax</div>
  <div class="g-section">CSS Parallax</div>
  <div class="g-section">CSS Parallax</div>
  <div class="g-section">CSS Parallax</div>
  <div class="g-section">CSS Parallax</div>
</div>
body {
  background: #000;
  font-family: "lato", lucida grande, lucida sans unicode, lucida, helvetica, Hiragino Sans GB, Microsoft YaHei, WenQuanYi Micro Hei, sans-serif;
  overflow: hidden;
}

.g-container {
  width: 100vw;
  height: 100vh;
  overflow-x: hidden;
  overflow: scroll;
  transform-style: preserve-3d;
  filter: blur(5px) contrast(5px);
  -webkit-animation: perspectiveChange 10s infinite ease-in;
          animation: perspectiveChange 10s infinite ease-in;
}

.g-section {
  position: absolute;
  top: 0;
  left: 0;
  width: 100vw;
  text-align: center;
  line-height: 100vh;
  padding: 30vh 0;
  font-size: 15vh;
}

.g-section:nth-child(1) {
  transform: translate3d(-200px, 0, -1px) scale(1.1);
  color: rgba(255, 170, 51, 0.8);
  z-index: 1;
}

.g-section:nth-child(2) {
  transform: translate3d(-200px, 0, -2px) scale(1.2);
  color: rgba(221, 255, 51, 0.8);
  z-index: 2;
}

.g-section:nth-child(3) {
  transform: translate3d(-200px, 0, -3px) scale(1.3);
  color: rgba(102, 255, 51, 0.8);
  z-index: 3;
}

.g-section:nth-child(4) {
  transform: translate3d(-200px, 0, -4px) scale(1.4);
  color: rgba(51, 255, 119, 0.8);
  z-index: 4;
}

.g-section:nth-child(5) {
  transform: translate3d(-200px, 0, -5px) scale(1.5);
  color: rgba(51, 255, 238, 0.8);
  z-index: 5;
}

.g-section:nth-child(6) {
  transform: translate3d(-200px, 0, -6px) scale(1.6);
  color: rgba(51, 153, 255, 0.8);
  z-index: 6;
}

.g-section:nth-child(7) {
  transform: translate3d(-200px, 0, -7px) scale(1.7);
  color: rgba(68, 51, 255, 0.8);
  z-index: 7;
}

.g-section:nth-child(8) {
  transform: translate3d(-200px, 0, -8px) scale(1.8);
  color: rgba(187, 51, 255, 0.8);
  z-index: 8;
}

.g-section:nth-child(9) {
  transform: translate3d(-200px, 0, -9px) scale(1.9);
  color: rgba(255, 51, 204, 0.8);
  z-index: 9;
}

.g-section:nth-child(10) {
  transform: translate3d(-200px, 0, -10px) scale(2);
  color: rgba(255, 51, 85, 0.8);
  z-index: 10;
}

@-webkit-keyframes perspectiveChange {
  0% {
    perspective: 5px;
  }
  100% {
    perspective: 200px;
  }
}

@keyframes perspectiveChange {
  0% {
    perspective: 5px;
  }
  100% {
    perspective: 200px;
  }
}
暂无JavaScript代码

👁️ 实时预览