多宽度css网格

多宽度css网格,css,css-grid,Css,Css Grid,所以我试图创建一个这样的网格 我有顶部和底部的柱子大小相同,中间有一根柱子,并自动填充剩余空间。 这是我的密码 <section class="posts-grid"> <article class="post"> <img src="https://blog.flyingsaucer.nyc/hs-fs/hubfs/blog/pitchadri.png?width=1464&name=pitchadri.png" alt="">

所以我试图创建一个这样的网格

我有顶部和底部的柱子大小相同,中间有一根柱子,并自动填充剩余空间。

这是我的密码

<section class="posts-grid">
  <article class="post">
    <img src="https://blog.flyingsaucer.nyc/hs-fs/hubfs/blog/pitchadri.png?width=1464&name=pitchadri.png" alt="">

    <div class="blog-listing-info">
      <a href="#">
        <h2 class="blog-listing-title">13 things to make your US and UI design much better</h2>
      </a>
      <p class="blog-listing-tag">Design - 11 min read</p>
    </div>
  </article>

  <article class="post">
    <img src="https://blog.flyingsaucer.nyc/hs-fs/hubfs/blog/pitchadri.png?width=1464&name=pitchadri.png" alt="">

    <div class="blog-listing-info">
      <a href="#">
        <h2 class="blog-listing-title">13 things to make your US and UI design much better</h2>
      </a>
      <p class="blog-listing-tag">Design - 11 min read</p>
    </div>
  </article>

  <article class="post long-post">
    <div class="blog-listing-info">
      <a href="#">
        <h2 class="blog-listing-title">13 things to make your US and UI design much better</h2>
      </a>
      <p class="blog-listing-tag">Design - 11 min read</p>
    </div>
  </article>

  <article class="post">
    <img src="https://blog.flyingsaucer.nyc/hs-fs/hubfs/blog/pitchadri.png?width=1464&name=pitchadri.png" alt="">

    <div class="blog-listing-info">
      <a href="#">
        <h2 class="blog-listing-title">13 things to make your US and UI design much better</h2>
      </a>
      <p class="blog-listing-tag">Design - 11 min read</p>
    </div>
  </article>

  <article class="post">
    <img src="https://blog.flyingsaucer.nyc/hs-fs/hubfs/blog/pitchadri.png?width=1464&name=pitchadri.png" alt="">

    <div class="blog-listing-info">
      <a href="#">
        <h2 class="blog-listing-title">13 things to make your US and UI design much better</h2>
      </a>
      <p class="blog-listing-tag">Design - 11 min read</p>
    </div>
  </article>

  <article class="post">
    <img src="https://blog.flyingsaucer.nyc/hs-fs/hubfs/blog/pitchadri.png?width=1464&name=pitchadri.png" alt="">

    <div class="blog-listing-info">
      <a href="#">
        <h2 class="blog-listing-title">13 things to make your US and UI design much better</h2>
      </a>
      <p class="blog-listing-tag">Design - 11 min read</p>
    </div>
  </article>
</section>
我已经创建了一个代码笔,但正如你所看到的,它忽略了一个很好的例子


我们非常感谢您对我的帮助。

这是我所能做的最好的了,我希望能有所帮助

HTML:

下面是JSFIDLE:

您可以交替使用不同的子网格,下面是另一种布局的想法:将网格设置为10或20列,而不是两列。然后根据需要跨越网格区域。例如,左上角的项目可以跨越5列。左下角的项目可以跨越10。你能提供一个例子@Michael_B I'm new to The grid Systems吗?事实上,正确的方法()是你在问题中发布足够的代码来重现问题。我在这里提出了一个新问题@Michael_B
.posts-grid {
    grid-template-areas:
    "post post"
    "long-post post"
    "post post";
    grid-template-columns: 15% 1fr;
    grid-template-rows: 80px 1fr;
    grid-auto-rows: 385px;
    grid-column-gap: 23px;
    grid-row-gap: 20px;
    height: 100vh;
    display: grid;
  }

  .post { grid-area: post; }
  .post.long-post { grid-area: long-post !important; }
<section class="posts-grid">
    <article class="post">
        <img src="https://blog.flyingsaucer.nyc/hs-fs/hubfs/blog/pitchadri.png? 
         width=1464&name=pitchadri.png" alt="">

        <div class="blog-listing-info">
        <a href="#">
            <h2 class="blog-listing-title">13 things to make your US and UI design 
            much better</h2>
        </a>
        <p class="blog-listing-tag">Design - 11 min read</p>
        </div>
    </article>

    <article class="post">
        <img src="https://blog.flyingsaucer.nyc/hs-fs/hubfs/blog/pitchadri.png? 
width=1464&name=pitchadri.png" alt="">

        <div class="blog-listing-info">
        <a href="#">
            <h2 class="blog-listing-title">13 things to make your US and UI design much better</h2>
        </a>
        <p class="blog-listing-tag">Design - 11 min read</p>
        </div>
    </article>

    <article class="post">
        <img src="https://blog.flyingsaucer.nyc/hs-fs/hubfs/blog/pitchadri.png?width=1464&name=pitchadri.png" alt="">

        <div class="blog-listing-info">
        <a href="#">
            <h2 class="blog-listing-title">13 things to make your US and UI design much better</h2>
        </a>
        <p class="blog-listing-tag">Design - 11 min read</p>
        </div>
    </article>

    <article class="long-post">
        <div class="blog-listing-info">
        <a href="#">
            <h2 class="blog-listing-title">13 things to make your US and UI design much better</h2>
        </a>
        <p class="blog-listing-tag">Design - 11 min read</p>
        </div>
    </article>

    <article class="post">
        <img src="https://blog.flyingsaucer.nyc/hs-fs/hubfs/blog/pitchadri.png?width=1464&name=pitchadri.png" alt="">

        <div class="blog-listing-info">
        <a href="#">
            <h2 class="blog-listing-title">13 things to make your US and UI design much better</h2>
        </a>
        <p class="blog-listing-tag">Design - 11 min read</p>
        </div>
    </article>

    <article class="post">
        <img src="https://blog.flyingsaucer.nyc/hs-fs/hubfs/blog/pitchadri.png?width=1464&name=pitchadri.png" alt="">

        <div class="blog-listing-info">
        <a href="#">
            <h2 class="blog-listing-title">13 things to make your US and UI design much better</h2>
        </a>
        <p class="blog-listing-tag">Design - 11 min read</p>
        </div>
    </article>

    <article class="post">
        <img src="https://blog.flyingsaucer.nyc/hs-fs/hubfs/blog/pitchadri.png?width=1464&name=pitchadri.png" alt="">

        <div class="blog-listing-info">
        <a href="#">
            <h2 class="blog-listing-title">13 things to make your US and UI design much better</h2>
        </a>
        <p class="blog-listing-tag">Design - 11 min read</p>
        </div>
    </article>
</section>
* {
    padding: 0px;
    margin: 0px;
    box-sizing: border-box;
}
   .posts-grid {
    padding: 10px;
    display: grid;
    grid-gap: 10px;
    grid-template-columns: repeat(5, 1fr);
    grid-template-rows: auto;
    .post, .long-post {
        padding: 10px;
        border-radius: 6px;
    }

    .post:first-child, .long-post + .post {
        background: greenyellow;
        grid-column-end: span 3;
    }
    .post + .post + .post {
        grid-column-end: span 1;
    }
    .post {
        background: lightblue;
        grid-column-start: auto;
        grid-column-end: span 2;
    }

    .long-post {
        background: red;
        grid-column-end: span 4;
    }

    img {
        width: 100%;
        height: auto;
    }
}