当前位置:   article > 正文

【CSS】grid 布局一行自动填充,每行最大限定px

【CSS】grid 布局一行自动填充,每行最大限定px

在这里插入图片描述

    <div class="model-plat-content">
      <div class="mode-card" v-for="i in 30"></div>
    </div>
  • 1
  • 2
  • 3
  .model-plat-content {
    display: grid;
    // 解释: repeat(auto-fit, minmax(250px, 1fr)) 自动填充,每行最大250px,最小1fr
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    grid-gap: 20px;
    .mode-card {
      width: 250px;
      height: 250px;
      border-radius: 20px;
      background-color: #252525;
    }
  }
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/Cpp五条/article/detail/478328
推荐阅读
  

闽ICP备14008679号