简体   繁体   English

引导行和列说明

[英]Bootstrap row and col explanation

Is this valid bootstrap? 这是有效的引导程序吗?

<div class="row">
 <div class="col-sm-6"></div>
 <div class="col-sm-6"></div>
 <div class="col-sm-6"></div>
 <div class="col-sm-6"></div>
 <div class="col-sm-6"></div>
</div> 

Or do I need a new row every 12 columns? 还是我每12列需要一个新行?

Because right now it does not work for me to do this way. 因为现在这样对我来说行不通。 And I do not want to have a row every 12th because I need to filter my articles, and I cant do that when they are in different rows. 而且我不想每12号就有一行,因为我需要过滤我的文章,而当它们位于不同的行中时,我不能这样做。

Bootstrap has a own Grid-System , which allows you up to 12 columns . Bootstrap具有自己的网格系统 ,该系统 最多允许您12列 From the docu: 从文档中:

Bootstrap includes a responsive, mobile first fluid grid system that appropriately scales up to 12 columns as the device or viewport size increases. Bootstrap包括一个响应式,可移动的第一流体网格系统,该系统可随着设备或视口尺寸的增加而适当扩展至12列。

It has a reason why it is just 12, and not as many as you want to have. 它有一个原因,为什么它只有12个,而不是您想要的那么多。 This article describes it perfectly well: The Subtle Magic Behind Why the Bootstrap 3 Grid Works 本文对它的描述非常完美: Bootstrap 3网格为何起作用的微妙魔术

After reading this, you are perfectly ready to work with Bootstraps grid system in the way its meant to be. 阅读完此内容后,您就可以按照自己的意愿完全准备好使用Bootstraps网格系统了。

You will get a new visual row every 12 columns, but you don't need to define it with markup. 您将每12列获得一个新的可视行,但无需使用标记进行定义。

From the documentation : 文档中

If more than 12 columns are placed within a single row, each group of extra columns will, as one unit, wrap onto a new line. 如果在一行中放置超过12列,则每组额外的列将作为一个单元包装到新行上。

Check out the official bootstrap docs on the grid system . 查看网格系统上的官方引导文档。 It's pretty straight forward. 非常简单。

Basically each row should only add up to 12. So you'd be able to fit two col-sm-6 divs within a single row (displayed as two side-by-side columns) 基本上每行最多只能加12。因此,您可以在一行中容纳两个col-sm-6 div(显示为两个并排的列)

"Do I need a new row every 12 columns?".. “我是否需要每12列有一个新行?”。

Contrary to popular opinion, it is okay to have columns that total more than 12 units in a single .row . 与流行观点相反,在单个.row中具有总计超过12个单位的是可以的 It simply causes the row to wrap. 它只是导致行换行。 This is known as column wrapping .. 这就是所谓的列包装 ..

"If more than 12 columns are placed within a single row, each group of extra columns will, as one unit, wrap onto a new line" “如果一行中放置超过12列,则每组额外的列将作为一个单元包装到新行上”

So this... 所以这...

<div class="row">
 <div class="col-sm-6"></div>
 <div class="col-sm-6"></div>
 <div class="col-sm-6"></div>
 <div class="col-sm-6"></div>
</div> 

Is functionally the same as... 在功能上 ... 相同

<div class="row">
 <div class="col-sm-6"></div>
 <div class="col-sm-6"></div>
</div>
<div class="row">
 <div class="col-sm-6"></div>
 <div class="col-sm-6"></div>
</div> 

Having more than 12 columns per row is a common scenario when creating col-* dynamically. 动态创建col-*时,通常每行有12列以上。 If you're having a problem with gaps in columns of different height you can use a CSS clearfix every n-TH column like this.. http://www.codeply.com/go/J6cCo3xL7H 如果您在不同高度的列中存在间隙问题,可以像这样在每个n-TH列中使用CSS clearfix。.http ://www.codeply.com/go/J6cCo3xL7H

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM