twitter-bootstrap Bootstrap Grid,我需要一个容器吗?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19063976/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Bootstrap Grid, do I need a container?
提问by Jose Rodriguez Masis
I've been playing with bootstrap 3 and I noticed that if you use the Grid System without a container it becomes fluid, someone told me I shouldn't do that because the system was design to be within a container. What happens if I don't use the container class?, do I need it?, if so could I make the container class width 100% without messing up bootstrap's media-queries, or is there any other or better way to build a fluid layout with bootstrap 3.
我一直在玩引导程序 3,我注意到如果你在没有容器的情况下使用网格系统,它会变得流畅,有人告诉我我不应该这样做,因为系统被设计成在容器内。如果我不使用容器类会发生什么?,我需要它吗?,如果可以,我可以在不弄乱引导程序的媒体查询的情况下使容器类宽度为 100%,或者有其他或更好的方法来构建流体布局与引导 3。
回答by Zim
Update Bootstrap 4
更新引导程序 4
Rows should also be wrapping in containeror container-fluidin Bootstrap 4 to prevent horizontal scolling caused by negative margins on the .row.
行也应该在 Bootstrap 4中container或container-fluid中换行,以防止由.row.
Bootstrap 3
引导程序 3
You should wrap rowin containeror you'll have a problem with the negative margins that BS 3 uses for the rowelement. Basically the rowis designed to be within a container. Read more on the Bootstrap grid
您应该换行row,container否则 BS 3 用于row元素的负边距会出现问题。基本上row设计为在容器内。阅读有关 Bootstrap 网格的更多信息
Play with this example on Bootply: http://bootply.com/83751
在 Bootply 上玩这个例子:http://bootply.com/83751
回答by Aajahid
I think you need it. Without the container it kind a works - but it shows a horizontal scroll bar at the bottom of the page and around 20px are cut off from rightside of the screen.
我认为你需要它。如果没有容器,它可以正常工作 - 但它会在页面底部显示一个水平滚动条,并且从屏幕右侧切掉了大约 20 像素。
See yourself how it works without the container class - just go to http://getbootstrap.com/and remove the container class using inspect element.
看看没有容器类它是如何工作的 - 只需转到http://getbootstrap.com/并使用检查元素删除容器类。
回答by Luis
Just use the container-fluid class instead of the container class. class="container-fluid" will allow you to use full width.
只需使用容器流体类而不是容器类。class="container-fluid" 将允许您使用全宽。

