【发布时间】:2021-05-01 13:45:36
【问题描述】:
我正在尝试建立简单的画廊。 我想要实现的是:
图像之间基本上有太多空间,我找不到解决方法。我知道这是因为justify-content: space-between;,但也许还有另一个选项可以减少图像之间的空间?
HTML
<div class="photoContainer>
<div class="ant-image">
...
</div>
</div>
CSS
.photosContainer {
width: 80%;
height: 100%;
overflow: auto;
overflow-x: hidden;
display: flex;
align-content: space-between;
flex-wrap: wrap;
align-items: center;
justify-content: space-between;
padding: 10px;
}
.ant-image {
height: fit-content;
flex-shrink: 0;
position: relative;
display: inline-block;
width: 200px;
}
【问题讨论】:
-
也许
justify-content: flex-start; -
@skobaljic 是的,可以解决问题,但创建一个我没有空格的新问题。当我尝试使用一些固定边距时,当我更改浏览器的大小时它看起来很糟糕,因为它经常在右侧留下空白。
标签: javascript html css reactjs antd