【问题标题】:How can I make image gallery works with twitter bootstrap?如何使图片库与 twitter bootstrap 一起使用?
【发布时间】:2015-03-09 15:49:51
【问题描述】:

我正在尝试在我的索引页面上使用图片库。但是很难得到期望的行为。这是我的代码:

.container
  .row
    .col-md-8.col-sm-8.col-xs-8
      - 4.times do |i|
        .col-md-1.col-sm-1.col-xs-1
          %img.img-responsive.img-rounded{:alt => "", :src => "http://placehold.it/300"}
    .col-md-4 //consider simple code in for this column !

我在添加容器、行等之前尝试过,但图像总是变小。我的代码有问题吗?我是否在引导行为方面犯了一些错误?

【问题讨论】:

标签: css image twitter-bootstrap


【解决方案1】:

我是新手,希望这是一个可以帮助你的答案:

我不知道你为什么要这样填。

容器的宽度(在 Bootstrap 计数中)为 12。因此您可以放入 12 个元素,其类为 col-**-1col-**-3 中的 4 个。如果你不填满它,它不会显得更大,虽然会有足够的空间。

这是一种在纯 html 中使用大小为 3 的列的解决方案,因此 4 张图像以合适的大小显示:

  <div class="container">
    <div class="row">
      <div class="col-md-12 col-sm-8 col-xs-8">
        <div class="col-md-3 col-sm-3 col-xs-3">
          <img class="img-responsive img-rounded" src="http://placehold.it/300" />
        </div>
        <div class="col-md-3 col-sm-3 col-xs-3">
          <img class="img-responsive img-rounded" src="http://placehold.it/300" />
        </div>
        <div class="col-md-3 col-sm-3 col-xs-3">
          <img class="img-responsive img-rounded" src="http://placehold.it/300" />
        </div>
        <div class="col-md-3 col-sm-3 col-xs-3">
          <img class="img-responsive img-rounded" src="http://placehold.it/300" />
        </div>
      </div>
    </div>
  </div>

顺便说一句:这是一种很酷的标记语言吗?

【讨论】:

  • 是哈姆。我不是 html 前端专家,也不想花时间编写 html/样式代码。所以我尝试了haml来尝试提高我的工作效率
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-01-17
  • 2013-09-26
  • 2013-08-09
  • 1970-01-01
相关资源
最近更新 更多