提问者:小点点

引导行超过容器流体的最大高度


我有以下问题,我并没有得到固定的引导网格系统。引导版本是v4。5.2

我在容器流体上设置了一个最高高度(50vh),工作正常。然后,我向包含2列的容器中添加了一行,但我的图像似乎没有正确调整大小,因为该行仅超出其父容器的最大高度,并根据图像高度进行调整。

下面是开发工具的图片。我尝试使用“img流体”类,但它对我的图像没有任何影响。

这是母容器流体

这是超出容器最大高度的子行

我哪里做错了?这是我的密码。

HTML

<div class="container-fluid view ">
    <div class="row h-100 d-flex align-items-center no-gutters">
        <div class="col-md-6 pl-5">
            <h1>Just a simple Heading that should align in the middle</h1>
        </div>
         <div class="col-md-6 d-flex align-items-center img-fluid flex-nowrap overflow-hidden heroImages">
                <img class="img-fluid" src="https://picsum.photos/600">
                <img src="https://picsum.photos/600">
        </div>
    </div>

CSS

html,header{
  height: 100%!important;
  width: 100% !important;
  margin-top: 0 !important;
  padding: 0 !important;
  color:black;
}

.view {
  max-height: 300px;
 /* max-height: 50vh; */
}

body {
  height: 100% !important;
  padding-top: 55px !important;
  background-color: rgba(255, 255, 255, 0.84) !important;
}

共1个答案

匿名用户

尝试将其添加到上面的代码中

.heroImages{
   height: 300px;
   display:flex;
  }
.heroImages img{
  display:block;
  height:100%;
  }

父div需要定义高度,该div内的图像需要显示为块。