【问题标题】:grid fixed gap between rows when there are not enough items?当没有足够的项目时,网格固定行之间的间隙?
【发布时间】:2021-05-11 11:12:53
【问题描述】:

您好,我遇到了这个问题,如果我没有足够的物品,它们之间的空间是否比我提供的行间距大?为什么会这样? (当我放 flex-wrap:wrap 时我也有同样的问题......

这是我在容器上的东西

display: grid;
grid-template-columns: repeat(auto-fill, minmax(280px, 400px));
grid-template-rows: 100px;
grid-column-gap: 10px;
grid-row-gap: 10px;
justify-content: center;
height: calc(100% - 204px);
padding: 10px 10px 60px 10px;

关于物品

height: 100px;
cursor:pointer;
width:100%;
border-radius: 0.75rem;

https://i.stack.imgur.com/f3g2h.png

【问题讨论】:

  • 请发布足够的代码来重现问题。

标签: css sass css-grid


【解决方案1】:

grid-template-rows: 100px; 表示第一行将是100px,所有其他行将具有自动高度。删除该属性或使用grid-auto-rows: 100px; 确保所有行的行为相同

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-08-05
    • 1970-01-01
    • 2016-04-07
    • 1970-01-01
    • 1970-01-01
    • 2013-08-14
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多