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.
The Bootstrap Grid can be used alone, without the Bootstrap JavaScript and other CSS Components. You just need to download and reference the “ bootstrap-grid. css ” which contains the Grid and Flexbox classes. More info on only using the Bootstrap Grid CSS is here in the docs.
container-fluid: The . container-fluid class provides a full-width container which spans the entire width of the viewport. In the below example, the div with class “container-fluid” will take up the complete width of the viewport and will expand or shrink whenever the viewport is resized.
How does Bootstrap work? To align and layout, the Bootstrap grid system uses a series of containers, rows, and columns. This grid system supports a max value of 12 columns. Anything after the 12th column will be shifted to a new line.
If you're layout-first, meaning you want to create the layout and then place items into it, then you'll be better off with CSS Grid. But if you're content-first, meaning you have items that you want to place into a container and space out evenly, go with Bootstrap.
Update Bootstrap 4
Outermost rows should also be wrapping in container
or container-fluid
in Bootstrap 4 to prevent horizontal scolling caused by negative margins on the .row
.
Bootstrap 3
You should wrap row
in container
or you'll have a problem with the negative margins that BS 3 uses for the row
element. Basically the row
is designed to be within a container. Read more on the Bootstrap grid
Play with this example on Bootply: http://bootply.com/83751
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.
See yourself how it works without the container class - just go to http://getbootstrap.com/ and remove the container class using inspect element.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With