css - Twitter Bootstrap 3 在调整大小时减少行中的列数

标签 css twitter-bootstrap-3

在不同设备上查看时减少一行中列数的最佳方法是什么。

我的页面在桌面上有 3 列,但我想在平板电脑上减少到两列。我的第三列应该怎么办?

<div class="container">
<div class="row">
 <!-- column one -->
 <div class="col-lg-6 col-md-6 col-sm-8 col-xs-12>
  <div>Content One</div>
 </div>

 <!-- column two -->
 <div class="col-lg-3 col-md-3 col-sm-4 col-xs-12>
  <div>Content Two</div>
 </div>

 <!-- column three -->
 <div class="col-lg-3 col-md-3 col-sm-?? col-xs-12>
  <div>Content Three</div>
 </div>

 </div>
 </div>

桌面

enter image description here

平板电脑

enter image description here

对于大型、中型和 xs 布局,它很好,但它会破坏 sm。我的布局应该是 6 3 3 大中型 12 xsmall

对于小我想减少 3 列 (6-3-3) 到 2 列 (8-4) 但我应该如何处理第三列

谢谢

一个

最佳答案

您可以将第 3 列换到下一行并使其全宽..

<div class="container">
<div class="row">
 <!-- column one -->
 <div class="col-lg-6 col-md-6 col-sm-8 col-xs-12">
  <div>Content One</div>
 </div>

 <!-- column two -->
 <div class="col-lg-3 col-md-3 col-sm-4 col-xs-12">
  <div>Content Two</div>
 </div>

 <!-- column three -->
 <div class="col-lg-3 col-md-3 col-sm-12 col-xs-12">
  <div>Content Three</div>
 </div>

 </div>
 </div>

在 Bootply 上使用它:http://bootply.com/99087

另外,不要忘记用双引号将类属性括起来。

选项 2..

另一种选择是应用一个特殊的类来在小型 设备上将第 3 列拉到右边:

/* pull-right on small devices */
@media (min-width: 992px) {
    .pull-right-sm {
        float: right;
    }
}

http://bootply.com/99089

选项 3..

另一种选择是使用嵌套,如下所示:http://bootply.com/99100

关于css - Twitter Bootstrap 3 在调整大小时减少行中的列数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20440853/

相关文章:

javascript - 如何让 DIV 占据容器 div 的其余高度?

javascript - 拖动 anchor 元素时停止 anchor href 导航?

html - 如何停止链接图片下的边框?

html - 如果没有其他列,则使宽度为 9 的列填满整个宽度

javascript - 无法在 Bootstrap 模式中显示 OpenLayers 3 map

HTML 标志背景

html - Bootstrap 将一张大图像与四张小图像对齐

html - 引导网格 1 太小 2 太宽

css - Bootstrap 3 元素未显示 ASP.NET MVC 5

html - 如何填充更改 Bootstrap 容器类