我正在使用Bootstrap 4,但我发现我的列没有达到行高的100%。
我假设Bootstrap 4的功能是列高度始终与行高度相同,如本工作示例所示:http://demo.tutorialzine.com/2016/11/boostrap-4-regular-vs-flex-grid/?5-column-height
由于某种原因,我似乎无法产生相同的结果。我尝试使用:
我想知道是否有人可以解释确保Bootstrap 4列达到行高100%的正确设置方法。
(整页查看,以确保准确呈现)
.row {
border: 1px solid green;
}
.our-research {
padding: 40px 0;
}
.our-research__container {
height: 100%;
border: 1px solid blue;
flex: 1;
display: flex;
flex-direction: column;
}
.our-research__content {
background-color: #fff;
text-align: center;
padding: 30px 35px;
color: #999;
height: 100%;
font-weight: 500;
flex: 1;
border: 1px solid red;
border-bottom-right-radius: 50px;
display: flex;
flex-direction: column;
}
.our-research__image {
position: relative;
height: 175px;
}
.our-research__image .our-research__image-main {
object-fit: cover;
height: 100%;
width: 100%;
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css">
<section class="our-research bg--light-grey">
<div class="container">
<div class="row align-items-stretch">
<div class="col-10 col-sm-3 our-research__container">
<div class="our-research__image">
<img class="our-research__image-main" src="http://via.placeholder.com/350x150" alt="">
</div>
<div class="our-research__content">
<h3 class="centered-heading__purple">Title</h3>
<p>Suspendisse arcu dui commodo non ornare sed consequat</p>
</div>
</div>
<div class="col-10 col-sm-3 our-research__container">
<div class="our-research__image">
<img class="our-research__image-main" src="http://via.placeholder.com/350x150" alt="">
</div>
<div class="our-research__content">
<h3 class="centered-heading__purple">Tumor Bank</h3>
<p>Suspendisse arcu dui commodo non ornare sed consequat</p>
</div>
</div>
<div class="col-10 col-sm-3 our-research__container">
<div class="our-research__image">
<img class="our-research__image-main" src="http://via.placeholder.com/350x150" alt="">
</div>
<div class="our-research__content">
<h3 class="centered-heading__purple">Research</h3>
<p>Suspendisse arcu dui commodo non ornare sed consequat</p>
</div>
</div>
<div class="col-10 col-sm-3 our-research__container">
<div class="our-research__image">
<img class="our-research__image-main" src="http://via.placeholder.com/350x150" alt="">
</div>
<div class="our-research__content">
<h3 class="centered-heading__purple">Title</h3>
<p>Suspendisse arcu dui.</p>
</div>
</div>
</div>
</div>
</section>
我在这里创建了问题的jsfiddle:https://jsfiddle.net/eilawen/zjoeh0yp/12/
任何帮助将不胜感激。
答案 0 :(得分:2)
从our-research_container中删除高度。
.our-research__container {
border: 1px solid blue;
flex: 1;
display: flex;
flex-direction: column;
}