
The right column will automatically grow to fill the width because we’re using an auto-layout. Here’s an example of combining the classic defined-width columns, with the auto-layout columns.
Remember, you can switch out sm for whatever breakpoint ( md, lg, xl) is needed: 1 2 3 Ģ columns, left sidebar. In this example, the `cols` remain horizontal until the sm breakpoint of 576px, and then stack vertically. The `cols` remain horizontal at all widths, and don’t stack vertically because the xs breakpoint is the default: 1 2 3 ģ equal-width columns (responsive). Take a look at a few auto-layout Grid examples…ģ equal-width columns. But, don’t forget, the 12-unit columns can be mixed-in as needed. The auto-layout columns are perfect for any layout scenarios where equal-width columns are required. Because of their simplicity, I now prefer them over the classic 12-unit columns. The Bootstrap 4 auto-layout columns also work responsively. The col- sm-6 means use 6 of 12 columns wide (50%), on a typical small device width ( greater than or equal to 768 px):
(xs) - screen width Column 1 Column 2. Responsive Breakpoints, based on screen width: “ Breakpoints”) that you may have noticed in some of the previous Column examples (ie col-lg-4, col-md). It’s all about width.īootstrap 4 has 5 Responsive Tiers (a.k.a. I’m not done talking about Rows & Columns yet, because they’re the star of the show when it comes to Responsive Design. Grid Tiers, Media Queries and Breakpoints, Oh My! DON’T PUT CONTENT DIRECTLY INSIDE THE ROW! ⛔ This is very bad, wrong way, no bueno!! This is also very bad, the wrong way!! No headings either! This is the wrong way!! Ĭolumns, and only columns, are placed inside the Row.Ĭontent is placed inside the Columns. The sole purpose of the “row” is to contain 1 or more “columns”. vertical layout is the essence of Responsive Design. Some times we want the column layout to be horizontal, while other times we want the columns to layout vertically down the viewport. row aren’t always laid-out horizontally across the viewport. When you think “row”, you probably think horizontal line, which is okay, BUT, it’s better to think of the. The name “row” is often misleading, and obscures the actual purpose of the. If you don’t put a Row in a Container, the Row will overflow it’s container, causing an undesirable horizontal scroll.įor a while now I’ve wished that the Bootstrap. This is to keep content evenly aligned on the edges of the layout. The Container padding of 15px is used to counteract the negative margins of the Row. Rows have a negative left/right margin of -15px. It’s important that a Container is used to contain grid Rows (. It all depends on what layout you’re trying to accomplish, but don’t get too concerned with that yet. You can have multiple Rows in a Container, and you can have multiple Containers on one page. When utilizing the Grid, one more Rows will be placed inside the Container. But, if you do utilize the Grid Rows & Columns, the Rows should be placed inside a Container. Reminder: A Container can be used to contain any content, not just the Grid Rows & Columns. container scales down in width responsively (as the screen width narrows) so that eventually it becomes full-width like the.
You can use either one:ġ - Fixed-width container to center your layout in the middle: Ģ - Full-width container for a layout the spans the entire width: container, but there is also the full-width. The Container is used to counteract the negative margins of the Row which I will explain a little further down.įYI: Viewport - The visible area inside the browser window.īootstrap 4 has 2 types of Containers. The Container is also used to evenly align the left and right edges of the layout within the browser’s viewport. For example, this is perfectly valid Bootstrap markup: My Heading I'm content inside the grid! Īt first, the Container may seem trivial or unnecessary, but it’s very important to control width of the layout.
It’s not only used for the Grid Rows & Columns. The Container can be used to hold any elements and content. The Container is the root (a.k.a: top-level, outermost) element of the Bootstrap Grid. In the basic example before you may have noticed that I used the.
#RESPONSIVE GRIDS BOOTSTRAP HOW TO#
How to Use the Bootstrap Grid _The Right Way.