简体   繁体   English

引导中的流体网格系统

[英]Fluid Grid System in bootstrap

I'm currently reading a book about Bootstrap, Publications O'REILLY 我目前正在阅读有关Bootstrap的书,出版物O'REILLY

It seems nesting a fluid grid is a little different: Since we are using percentages, each row resets the column count to 12. For example, if you were inside a Span8 , instead of two span4 elements to divide the content in half, you would use two span6 divs (see Fluid Grid System | 5 Figure 1-4). 似乎嵌套一个流体网格有点不同:由于我们使用百分比,因此每一行会将列数重置为12。例如,如果您在Span8 ,而不是两个span4元素将内容分为两半,则可以使用两个span6 divs (请参见流体网格系统| 5图1-4)。

This is the case for responsive content, as we want the content to fill 100% of the container: 响应式内容就是这种情况,因为我们希望内容填充容器的100%:

<div class="row-fluid">

    <div class="span8">
        level 1 of column
        <div class="row">
            <div class="span6">
                Level 2
            </div>
            <div class="span6">
                Level 2
            </div>
        </div>
    </div>
</div>

My question is , why instead of using two span4 of span6 should we be content to fill 100% of the container? 我的问题是 ,为什么我们不应该满足于使用span6两个span4来填充100%的容器?

Because grid span width is calculated based on the entire grid width, not the parent span of the element in question. 由于网格跨度宽度是根据整个网格宽度计算的,而不是所讨论元素的父跨度。

Imagine a scenario where you have 3 or 4 levels of nesting. 想象一下您有3或4级嵌套的情况。 width calculations would get very complex. 宽度计算将变得非常复杂。 By keeping everything relative to the grid's outer structure, both visualization and the CSS itself remain simplified. 通过使所有内容都相对于网格的外部结构,可视化和CSS本身都得以简化。

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

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