zoukankan      html  css  js  c++  java
  • CSS

    <!DOCTYPE html>
    <html lang="en">
      <head>
        <meta charset="UTF-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <title>视差滚动</title>
        <style>
          * {
            box-sizing: border-box;
          }
          html,
          body {
            margin: 0;
            padding: 0;
          }
          html{
              overflow: hidden;
          }
          body {
            height: 100vh;
    
            /* 开启3d */
            perspective: 100px;
            transform-style: preserve-3d;
            overflow-y: auto;
          }
          .main {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
          }
          .list-item {
            position: relative;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            width: 100%;
            height: 45vh;
            overflow: hidden;
          }
          .list-item:hover .item-image::before {
            background-color: rgba(0, 0, 0, 0.2);
          }
          .item-image {
            position: absolute;
            width: 100%;
            height: 100%;
            z-index: -1;
            transform: translateZ(-50px) scale(2.4);
          }
          .item-image::before {
            content: "";
            display: block;
            position: absolute;
            width: 100%;
            height: 100%;
            background-color: rgba(0, 0, 0, 0.4);
            transition: all 0.3s ease;
          }
          .item-image img {
            display: block;
            width: 100%;
            height: 100%;
            /* object-fit 需要设定尺寸 */
            object-fit: cover;
          }
          .item-text {
            color: #fff;
            text-align: center;
            font-family: "Courier New", Courier, monospace;
          }
          .text-title {
            font-size: 2rem;
            font-weight: bolder;
            margin-bottom: 20px;
          }
          .text-desc {
            font-size: 1.2rem;
          }
        </style>
      </head>
      <body>
        <div class="main">
          <div class="list-item">
            <div class="item-image">
              <img src="./img/4.png" alt="" />
            </div>
            <div class="item-text">
              <div class="text-title">CSS3D动画</div>
              <div class="text-desc">
                采用 animation + transition 组合完成各种动画加过渡效果
              </div>
            </div>
          </div>
          <div class="list-item">
            <div class="item-image">
              <img src="./img/2.jpg" alt="" />
            </div>
            <div class="item-text">
              <div class="text-title">CSS3D动画</div>
              <div class="text-desc">
                采用 animation + transition 组合完成各种动画加过渡效果
              </div>
            </div>
          </div>
    
          <div class="list-item">
            <div class="item-image">
              <img src="./img/3.jpg" alt="" />
            </div>
            <div class="item-text">
              <div class="text-title">CSS3D动画</div>
              <div class="text-desc">
                采用 animation + transition 组合完成各种动画加过渡效果
              </div>
            </div>
          </div>
    
          <div class="list-item">
            <div class="item-image">
              <img src="./img/5.jpg" alt="" />
            </div>
            <div class="item-text">
              <div class="text-title">CSS3D动画</div>
              <div class="text-desc">
                采用 animation + transition 组合完成各种动画加过渡效果
              </div>
            </div>
          </div>
          <div class="list-item">
            <div class="item-image">
              <img src="./img/6.jpg" alt="" />
            </div>
            <div class="item-text">
              <div class="text-title">CSS3D动画</div>
              <div class="text-desc">
                采用 animation + transition 组合完成各种动画加过渡效果
              </div>
            </div>
          </div>
          <div class="list-item">
            <div class="item-image">
              <img src="./img/1.jpg" alt="" />
            </div>
            <div class="item-text">
              <div class="text-title">CSS3D动画</div>
              <div class="text-desc">
                采用 animation + transition 组合完成各种动画加过渡效果
              </div>
            </div>
          </div>
        </div>
      </body>
    </html>

    出处: https://www.bilibili.com/video/BV1Yt4y127Ds?from=search&seid=1888009266108241519

  • 相关阅读:
    VC 中与字符串相关的宏 _T、TEXT,_TEXT、L 的作用(简单明了)
    内存泄露检测工具(25款)
    谈VC++对象模型
    函数调用堆栈分析
    一个跨平台的 C++ 内存泄漏检测器
    网站架构资料收集整理
    分布式缓存系统memcached简介与实践
    反向代理(Reverse Proxy)
    squid和varnish的小结
    ajax简单后台交互
  • 原文地址:https://www.cnblogs.com/500m/p/13548571.html
Copyright © 2011-2022 走看看