【问题标题】:Row span in Bootstrap 3?Bootstrap 3中的行跨度?
【发布时间】:2014-11-03 04:02:32
【问题描述】:

是否可以在 Bootstrap 3 中执行此操作,如果可以,如何操作? (盒子是 div)

【问题讨论】:

  • Bootstrap 是 css 和 jQuery,您可以添加或从中获取。没有这样的设计模式。这是一个等高的 2 列网格,右侧有两个内部框。你可以扩展 Bootstrap,但是你为什么不谷歌搜索等高的 Bootstrap 列,尝试一下,然后一旦你选择了一个(不要选择填充底部的方法),然后将两个框的高度设为 50%

标签: twitter-bootstrap twitter-bootstrap-3


【解决方案1】:

我创建这个是因为另一个答案(现在已删除)非常错误。这是执行此操作的众多方法之一。我通常使用 jQuery。这假设这是一个响应式布局。希望我对自己说,我不会回答没有付出任何努力的问题。如果您有所需的布局模式,但在 GetBootstrap.com 网站上的文档或示例中没有看到它,则它可能没有随框架提供。

演示:http://jsbin.com/wuwis/1/

http://jsbin.com/wuwis/1/edit

HTML:

<div class="container">
   <div class="row equal-heights">
      <div class="col-sm-6">
         Primary Box put something in here that will accomodate the height of the other two boxes
      </div>
      <!--/.col-X-6 -->
      <div class="col-sm-6">
         <div class="box">
            Secondary Box
         </div><!--/.box -->
         <div class="box">
            Tertiary Box
         </div><!--/.box -->
      </div>
      <!--/.col-X-6 -->
   </div>
   <!--/.row -->
</div>
<!--/.container -->  

CSS:

.row.equal-heights [class*="col-"] {
    border: 1px solid red;
    padding:0;
}
.box {
    border: 1px solid green
}
@media (min-width:768px) { 
    .row.equal-heights {
        width: 100%;
        margin: 0 auto;
        height: 600px;
        display: table;
        /* unless you have content that keeps this open */
    }
    .row.equal-heights [class*="col-"] {
        height: 100%;
        float: none;
        display: table-cell;
    }
    .row.equal-heights .box {
        height: 50%
    }
}

【讨论】:

  • 酷,感谢您的详细回复!请原谅我的无知,但为什么我不能这样做:pastebin.com/L3T9QKUK
  • 如果您粘贴的图片看起来像您所做的那样,那么这就是答案。如果您正在使用图像,请查看:jsbin.com/gacegu/1/edit - 您不需要嵌套的行或列,并且需要添加图像类以及图像的大小需要正确的宽度
  • 现在查看 img-fluid 类(自定义非引导类),图像和网格从该列类的最小宽度开始流动。 jsbin.com/gacegu/2/edit
  • 嗯,这与 div 中的内容无关。只是 div 本身。
  • 然后您只需创建两列,然后在右侧列中创建几个 div(不是 col-X1-12),您可以放置​​两个 .well 或其他 div 或创建自己的,但是您不需要有很多html并再次嵌套网格系统。查看 GetBootstrap.com、Bootsnipp.com、StartBootstrap 上的示例。
猜你喜欢
  • 2016-10-27
  • 1970-01-01
  • 1970-01-01
  • 2013-05-13
  • 1970-01-01
  • 2015-10-13
  • 2013-04-22
  • 2014-04-14
  • 1970-01-01
相关资源
最近更新 更多