我如何删除此bootstrap 4模态右侧的多余空间?

问题描述 投票:0回答:1

这里是小提琴:https://jsfiddle.net/apo5u0mt/

这里是代码:

HTML

<div class="modal" id="galleryModal">
  <div class="modal-dialog modal-dialog-centered modal-dialog-scrollable modal-xl">
    <div class="modal-content">
      <div class="gallery">
        <div class="gallery-item">
          <img src="https://preview.ibb.co/kPE1D6/clouds.jpg">
        </div>
        <div class="gallery-item">
          <img src="https://preview.ibb.co/mwsA6R/img7.jpg">
        </div>
        <div class="gallery-item">
          <img src="https://preview.ibb.co/kZGsLm/img8.jpg">
        </div>
      </div>
    </div>
  </div>
</div>

<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#galleryModal">
Modal
</button>

CSS

.gallery {
  overflow-y: auto !important;
}

.gallery-item {
  margin: 5px;
  float: left;
}

.gallery-item img {
  height: 150px;
  width: 200px;
  object-fit: cover;
}

.btn {
  margin: 5px;
}

模式右侧有一些额外的空间。我不要那个空间。我希望模态适合内容,即图像。我一直盯着这个看了太久了,不胜感激。

html css bootstrap-4 bootstrap-modal
1个回答
0
投票

引导程序正在执行此操作:

© www.soinside.com 2019 - 2024. All rights reserved.