Bootstrap 3中缩略图列的高度相同 [英] Same height for thumbnail columns in Bootstrap 3
问题描述
所以,首先我创建了一个style.css并将其导入到我的index.php中(我还包括其他样式参考我实际上使用和下面的代码的重要部分):
$ b
index.php
< link rel =stylesheethref =./ static / style.css>
< link rel =stylesheethref =https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css>
...
< div class =container-fluid>
< div class =row>
< div class =col-md-4>
< div class =thumbnail>
< img src =./ img / animazione.jpgalt =Animazionestyle =width:100%>
< div class =caption>
< h2>一些文字COL2< / h2>
< / div>
< / div>
< / div>
< div class =col-md-4>
< div class =thumbnail>
< img src =./ img / rinnovabili.jpgalt =Rinnovabilistyle =width:100%>
< div class =caption>
< h2>一些文字COL2< / h2>
< / div>
< / div>
< / div>
< div class =col-md-4>
< div class =thumbnail>
< img src =./ img / rugby.jpgalt =Rugbystyle =width:100%>
< div class =caption>
< h2>一些文字COL3< / h2>
< / div>
< / div>
< / div>
< / div>
我的style.css就像(建议 ):
$ b style.css
.equal {
display:flex;
display:-webkit-flex;
flex-wrap:wrap;
}
之后,我尝试将< div class =row>
with < div class =row equal>
但没有任何事情发生:列仍然是不同的高度。我也尝试将style.css的第一行设置为 .row.equal {
但仍然没有运气。
我正在使用FireFox版本。 53.当我打开开发工具时,我可以看到
flexbox
相关的东西,但是我是新手,我真的不知道如何解决这个问题。 我也建议使用 bootply 。希望这有助于理解我的观点。
列的高度相同,但列中的缩略图不填充高度。只需设置高度...
.row.equal {
display:flex;
display:-webkit-flex;
flex-wrap:wrap;
身高:100%;
}
.thumbnail {
height:100%;
}
https://www.bootply.com/8wQiUUKL53
I've been reading lot of answers on how to have same height columns within the same row, but none seems to work in my case. I know the solution is probably something really dumb, but I cannot figure it out... So, first I created a style.css and imported it in my index.php this way (I also include the other style reference I am actually using and the important part of the code below):
index.php
<link rel="stylesheet" href="./static/style.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
...
<div class="container-fluid">
<div class="row">
<div class="col-md-4">
<div class="thumbnail">
<img src="./img/animazione.jpg" alt="Animazione" style="width:100%">
<div class="caption">
<h2>Some text COL2</h2>
</div>
</div>
</div>
<div class="col-md-4">
<div class="thumbnail">
<img src="./img/rinnovabili.jpg" alt="Rinnovabili" style="width:100%">
<div class="caption">
<h2>Some text COL2</h2>
</div>
</div>
</div>
<div class="col-md-4">
<div class="thumbnail">
<img src="./img/rugby.jpg" alt="Rugby" style="width:100%">
<div class="caption">
<h2>Some text COL3</h2>
</div>
</div>
</div>
</div>
My style.css is like (as proposed here):
style.css
.equal {
display: flex;
display: -webkit-flex;
flex-wrap: wrap;
}
After that, I tried to replace <div class="row">
with <div class="row equal">
but nothing happened: the columns are still each a different height. I also tried to set the first row of my style.css to .row.equal{
but still with no luck.
I am using FireFox ver. 53. When i open the Developer Tools, I can see that display: flex;
in my css is ignored (it's ruled out). I guess it is something related to flexbox
, but I am a novice and I really don't know how to solve this problem.
I also created a bootply as suggested. Hope it will help understanding my point.
The columns are equal height, but the thumbnails inside the columns are not filling the height. Just set the height...
.row.equal {
display: flex;
display: -webkit-flex;
flex-wrap: wrap;
height: 100%;
}
.thumbnail {
height: 100%;
}
https://www.bootply.com/8wQiUUKL53
这篇关于Bootstrap 3中缩略图列的高度相同的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!