我试图找出Bootstrap 3,有很多麻烦。 Bootstrap 3网站说:
Easily center a page’s contents by wrapping its contents in a .container. Containers set
width at varIoUs media query breakpoints to match our grid system.@H_403_5@Note that,due to padding and fixed widths,containers are not nestable by default.@H_403_5@
前一行似乎支持这一点,因为我不希望嵌套容器将宽度重新设置为超过父级。后一行让我认为,我不应该在一个页面(或最多的兄弟姐妹)上只有一个容器,不管流体/正常等等,而不做一些“额外的”。@H_403_5@
那是对的吗?@H_403_5@
解决方法
你是不正确的,你不想嵌套.containers。但是,有很多情况下您将拥有多个容器。例如,如果要使用全宽元素(屏幕宽度,而不是容器宽度)。这是非常好的:
<div class="container"> <div class="col-md-12"> <p>Content</p> </div> </div> <div id="full-width-element"> <p>Other content,stretching full width of the page</p> </div> <div class="container"> <div class="col-md-12"> <p>Content</p> </div> </div>
看看Bootstrap站点上的示例:http://getbootstrap.com/getting-started/#examples,他们也使用多个.containers。@H_403_5@