css实现滚动左侧粘性文字效果代码

代码语言:html

所属分类:加载滚动

代码描述:css实现滚动左侧粘性文字效果代码,滚动鼠标,左侧文字到达顶部后固定住,右侧图片可继续滚动,直到下一个段落。

代码标签: css 滚动 左侧 粘性 文字

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

<!DOCTYPE html>

<html lang="en">

<head>

    <meta charset="UTF-8">


    <link href="https://fonts.googleapis.com/css2?family=Space+Grotesk&display=swap" rel="stylesheet">



    <style>
        * {
          box-sizing: border-box;
        }
        
        html, body {
          padding: 0;
          margin: 0;
          font-family: "Space Grotesk", sans-serif;
        }
        
        .container {
          display: flex;
          padding: 40vh 0 15vh 0;
        }
        
        .section-heading {
          padding: 0 2.5%;
          width: 40%;
        }
        
        .sticky-heading {
          position: sticky;
          top: 25px;
          margin: 0;
          font-size: 48px;
        }
        
        .product-grid {
          display: flex;
          flex-wrap: wrap;
          width: 60%;
        }
        .product-grid.grid-half > div {
          width: 50%;
        }
        .product-grid.grid-full > div {
          width: 100%;
        }
        
        .product-card {
          padding: 0 25px;
          margin-bottom: 50px;
        }
        .product-card img {
          display: block;
          width: 100%;
          height: 500px;
          object-fit: cover;
          //filter: grayscale(1);
        }
    </style>



</head>

<body>
    <div class="container">
        <div class="section-heading">
            <h2 class="sticky-heading"> Beauty is in the eye of the beholder. I think that's how it goes...</h2>
        </div>

        <div class="product-grid grid-half">
            <div class="product-card">
                <img src="//repo.bfw.wiki/bfwrepo/image/5e62ef20b92ee.png" alt="">
            </div>
            <div class="product-card">
                <img src="//repo.bfw.wiki/bfwrepo/image/5e62ef60656fd.png?x-oss-process=image/auto-orient,1/resize,m_fill,w_200,h_500,/quality,q_90" alt="">
            </div>
            <div class="product-card">
                <img src="//repo.bfw.wiki/bfwrepo/image/5e62ef60656fd.png?x-oss-process=.........完整代码请登录后点击上方下载按钮下载查看

网友评论0