Bootstrap 3中缩略图列的高度相同 [英] Same height for thumbnail columns in Bootstrap 3

查看:138
本文介绍了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.当我打开开发工具时,我可以看到 display:flex; 在我的css中被忽略(这是排除的)。我猜这是与 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆