桌面上的3列到平板电脑上的2列

Bra*_*ith 4 twitter-bootstrap twitter-bootstrap-3

我正在使用bootstrap 3并尝试显示多行,每行包含3个框.所有盒子都是相同的尺寸,因此非常均匀.您可以将其描绘为网格.在平板电脑上我只想要两列.

<div class="row">
   <div class="col-sm-6 col-md-4"> Uniform box of content here </div>
   <div class="col-sm-6 col-md-4"> Uniform box of content here </div>
   <div class="col-sm-6 col-md-4"> Uniform box of content here </div>
</div>

<div class="row">
   <div class="col-sm-6 col-md-4"> Uniform box of content here </div>
   <div class="col-sm-6 col-md-4"> Uniform box of content here </div>
   <div class="col-sm-6 col-md-4"> Uniform box of content here </div>
</div>
Run Code Online (Sandbox Code Playgroud)

现在,这在我的桌面上运行良好.在移动设备上,它们都会根据需要折叠成一列.在平板电脑上,它们都分为两个单元.但是,问题是我的列数不均匀,分成偶数列.这会留下一行2,然后是一行1.然后下一行创建一行2,后跟一行1.

是否有任何简单的方法可以让下一行"弹出"以在平板电脑上完成两列的行,同时在桌面上保留3列?就目前而言,我的平板电脑上每隔一行都有空列.

Ant*_*Chu 8

不要将它们分成不同的行,它应该按照你描述的方式行事......

<div>
   <div class="col-sm-6 col-md-4"> Uniform box of content here </div>
   <div class="col-sm-6 col-md-4"> Uniform box of content here </div>
   <div class="col-sm-6 col-md-4"> Uniform box of content here </div>
   <div class="col-sm-6 col-md-4"> Uniform box of content here </div>
   <div class="col-sm-6 col-md-4"> Uniform box of content here </div>
   <div class="col-sm-6 col-md-4"> Uniform box of content here </div>
</div>
Run Code Online (Sandbox Code Playgroud)

小提琴... http://jsfiddle.net/gmU7w/

  • @BrandonSmith想到它的一种方式就像一个段落,每个div都是一个单词.每个单词都分配了一定数量的宽度单位,并且只有12个单位可以放在一条线上.如果div不适合当前的"线",它"包裹"到下一行.在上面的例子中,每个div在4个单位宽的屏幕中等大(因此形成2行3),6个宽屏幕(3行2),和(因为没有单位定义)12宽x-小(6行1).您可以将外部div视为段落本身.不确定这是否有帮助,但这就是我对BS3网格系统的看法.:) (2认同)