为什么不应该嵌套引导容器?

时间:2015-11-04 00:11:42

标签: html css twitter-bootstrap

我有时会发现自己想要为内容在标准容器内的网站的一个部分放置全宽背景。类似的东西:

<div class="container">
  <!--here is a section of awesome things that doesn't need a full width background -->
</div>

<div class="container-fluid" style="background-color: purple">
  <div class="container>
    <p>This is an average paragraph</p>
  </div>
</div>

Bootstrap says NOT to nest containers

Note that, due to padding and more, neither container is nestable.

我明白我可以用一个类来制作一个不同的div,但我想知道嵌套容器的具体危险是什么?

1 个答案:

答案 0 :(得分:1)

抱歉无法在评论中解释,这是我关注的内容

<div class="container-fluid" style="background-color: purple">
    <div clas=row>
<!--here is a section of awesome things that doesn't need a full width background -->
    </div>
</div>
<div class="container-fluid" style="background-color: purple">
    <div clas=row>
        <div class="container>
                <div class=row>
                <p>This is an average paragraph</p>
                </div>
        </div>
    </div>
</div>