【发布时间】:2022-11-02 00:54:24
【问题描述】:
使用<figure>时如何调整图片间距?我想减少空间,但由于某种原因,我无法让它让步。
我想要 3 张图片放在一排,但是因为我无法减少图片之间的空间以让它们舒适地放入 div 框中,所以第三张是包装并位于前两张下方
.container3 {
width: 1000px;
height: 600px;
box-sizing: border-box;
}
.container3 figure {
display: inline-block;
box-sizing: border-box;
}
<div class="container3">
<figure>
<img class="image" height="200px" width="300px" src="/images/img-berryblitz.jpg" alt="berry blitz">
<figcaption>
Fall Berry Blitz Tea
</figcaption>
</figure>
<figure>
<img class="image" height="200px" width="300px" src="/images/img-spiced-rum.jpg" alt="spiced rum">
<figcaption>
Spiced Rum Tea
</figcaption>
</figure>
<figure>
<img class="image" height="200px" width="300px" src="/images/img-donut.jpg" alt="donut">
<figcaption>
Seasonal Donuts
</figcaption>
</figure>
</div>
【问题讨论】:
-
将
display:flex;添加到.container3css -
你不是在说
margin吗?像margin: 0;这样的东西会完全删除它。根据您的浏览器margin: 8px;可以减半。