我正在使用bootstrap v4(flexbox)col制作一些拇指,但是我无法找到使拇指内容适合整个列的解决方案。
因此,如果拇指的内容多于另一个,则它的高度会更高。
我需要所有拇指具有相同的尺寸,即使它们没有相同的内容。它实际上适用于我的项目,但只适用于Chrome。
.row {
display: flex;
display: -ms-flexbox;
display: -webkit-box;
flex-wrap: wrap;
-ms-flex-wrap: wrap;
}
.col-6 {
-webkit-box-flex: 0;
-ms-flex: 0 0 50%;
flex: 0 0 50%;
max-width: 50%;
padding-left: 15px;
padding-right: 15px;
width: 100%;
}
.thumb-accommodation {
height: 100%;
}
.thumb-accommodation__image {
height: 120px;
background-color: deeppink;
color: white;
padding: 10px;
}
.thumb-accommodation__content {
background-color: aqua;
height: calc(100% - 120px);
padding: 10px;
}
h3 {
margin: 0
}

<div class="row">
<div class="col-6">
<div class="thumb-accommodation">
<div class="thumb-accommodation__image">
<span>image</span>
</div>
<div class="thumb-accommodation__content">
<h3>
A realy realy realy realy realy realy realy realy big Title
</h3>
<p>
Lorem ipsum dolor Lorem ipsum dolor Lorem ipsum dolor Lorem ipsum dolor Lorem ipsum dolor Lorem ipsum dolor Lorem ipsum dolor....
</p>
</div>
</div>
</div>
<div class="col-6">
<div class="thumb-accommodation">
<div class="thumb-accommodation__image">
<span>image</span>
</div>
<div class="thumb-accommodation__content">
<h3>
Title
</h3>
<p>
Lorem ipsum dolor....
</p>
</div>
</div>
</div>
</div>
&#13;
答案 0 :(得分:2)
使用result = Program.Add(6, 3);
代替display: -webkit-flex;
并移除display: -webkit-box;
flex-wrap: wrap;
.row {
display: flex;
display: -ms-flex;
display: -webkit-flex;
}
&#13;
.row {
display: flex;
display: -ms-flex;
display: -webkit-flex;
}
.col-6 {
-webkit-flex: 0;
-ms-flex: 0 0 50%;
flex: 0 0 50%;
max-width: 50%;
padding-left: 15px;
padding-right: 15px;
width: 100%;
}
.thumb-accommodation {
height: 100%;
}
.thumb-accommodation__image {
height: 120px;
background-color: deeppink;
color: white;
padding: 10px;
}
.thumb-accommodation__content {
background-color: aqua;
height: calc(100% - 120px);
padding: 10px;
}
h3 {
margin: 0
}
&#13;
答案 1 :(得分:1)
您可以使用此jquery代码来制作相同的高度
$(document).ready(function(){
var heightBox = 0;
$('.thumb-accommodation__content').each(function(){
if($(this).height()>heightBox){
heightBox=$(this).height();
}
});
$('.thumb-accommodation__content').height(heightBox);
});
&#13;
.row {
display: flex;
display: -ms-flexbox;
display: -webkit-box;
flex-wrap: wrap;
-ms-flex-wrap: wrap;
}
.col-6 {
-webkit-box-flex: 0;
-ms-flex: 0 0 50%;
flex: 0 0 50%;
max-width: 50%;
padding-left: 15px;
padding-right: 15px;
width: 100%;
}
.thumb-accommodation {
height: 100%;
}
.thumb-accommodation__image {
height: 120px;
background-color: deeppink;
color: white;
padding: 10px;
}
.thumb-accommodation__content {
background-color: aqua;
height: calc(100% - 120px);
padding: 10px;
}
h3 {
margin: 0
}
&#13;
<div class="row">
<div class="col-6">
<div class="thumb-accommodation">
<div class="thumb-accommodation__image">
<span>image</span>
</div>
<div class="thumb-accommodation__content">
<h3>
A realy realy realy realy realy realy realy realy big Title
</h3>
<p>
Lorem ipsum dolor Lorem ipsum dolor Lorem ipsum dolor Lorem ipsum dolor Lorem ipsum dolor Lorem ipsum dolor Lorem ipsum dolor....
</p>
</div>
</div>
</div>
<div class="col-6">
<div class="thumb-accommodation">
<div class="thumb-accommodation__image">
<span>image</span>
</div>
<div class="thumb-accommodation__content">
<h3>
Title
</h3>
<p>
Lorem ipsum dolor....
</p>
</div>
</div>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
&#13;