如何調整bootstrap中grid之間的垂直距離 ?

1. 問題描述:

各位大牛午安,最近在使用bootstrap製作一個圖片的Gallery,我使用了bootstrap 的 Grid sysyem。我發現只要有圖片的高度與周邊圖片的高度不一,整個gallery就會多出很多空白(上下的距離不一),請問要如何調整成像是 Unsplash 這個網站的樣子?

2. 相關代碼:
<div class="row text-center" style="display:flex;flex-wrap:wrap;">
      
        <div class="col-lg-3 col-md-4 col-sm-6">
            <div class="thumbnail">
                <img src=image.jpg>" >
                <div class="caption">
                    <h3>description</h3>
                </div>
            </div>
        </div>

</div>
3.相關截圖:

會多出空白
如果照片的height越大,差距會越大。

4.已嘗試的做法:
在style中改變 display。
style="display:flex;flex-wrap:wrap;"

該如何調整grid 的上下距離?

阅读 2.4k
1 个回答

为什么不给图片设置一个百分比

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题