You can use flex utilities on the container and columns to create a flexbox grid.
This can be useful for keeping columns the same height, justifying content and vertically aligning items. The flexbox grid is also great for working with responsive layouts.
.clearfix on the container and float utilities with columns for a floated grid layout.
To reverse the order of columns, use
float-right to float columns to the right.
You can infinitely nest grid layouts within other columns since the column widths are percentage based. With great flexibility comes great responsibility - be sensible with how far you nest!
.mx-auto to center columns within a container.
Column widths can be used with any other block or inline-block elements to add percentage-based widths.
Using column offset classes can push a div over X number of columns. They work responsively using the breakpoints outlined below.
Use gutter styles or padding utilities to create gutters. You can use the default gutter style,
gutter, or either of its modifiers,
gutter-spacious. Gutter styles also support responsive breakpoint modifiers. Gutter styles add padding to the left and right side of each column and apply a negative margin to the container to ensure content inside each column lines up with content outside of the grid.
Use padding utilities to create gutters for more customized layouts.
Use column widths with
d-inline-block as an alternative to floated grids.
You can use column widths and other utilities on elements such as lists to create the layout you need while keeping the markup semantically correct.
Using display table utilities with columns gives you some alternative layout options.
A useful example is being able to keep the height of the container equal across a row when the length of content may differ.
Note that table cells will fill the width of their container even when the total columns doesn't add up to 12.
All the column width classes can be set per breakpoint to create responsive grid layouts. Each responsive style is applied to the specified breakpoint and up.
We use abbreviations for each breakpoint to keep the class names concise.
lg breakpoint matches our current page width of
980px including left and right padding of
12px. This is so that content doesn't touch the edges of the window when resized.
In this example at the
sm breakpoint 2 columns will show, at the
md breakpoint 4 columns will show, and at the
lg breakpoint 6 columns will show.
For demonstration, this is how the above example would look at the
This is how that same example would look at the
This is how that example would look at the
Container widths match our breakpoints and are available at a
xl size. Containers apply a max-width rather than a fixed width for responsive layouts, and they center the container.