Grid system


New member
New Member
Bootstrap 4 grid system
Use the powerful mobile-first flexbox grid to build layouts of all shapes and sizes thanks to a twelve column system, five default responsive tiers, Sass variables and mixins, and dozens of predefined classes.
--- Posts Merged by Spam-Bot ---
How it works
Bootstrap’s grid system uses a series of containers, rows, and columns to layout and align content. It’s built with flexbox and is fully responsive. Below is an example followed by an in-depth look at how the grid comes together.

New to or unfamiliar with flexbox? Then, please read our CSS flexbox guide.
--- Posts Merged by Spam-Bot ---
The above example creates three equal-width columns on small, medium, large, and extra large devices using our predefined grid classes. Those columns are centered on the page with the parent .container.

Breaking it down, here’s how it works:

  • Containers provide a means to center your site’s contents. Use the class .container for fixed width or .container-fluidfor variable width: 100% across all viewport and device sizes.
  • Rows are wrappers for columns. Each column has some horizontal padding (called a gutter) for controlling the space between them. This padding is then counteracted on the rows with negative margins. This way, all the content in your columns is visually aligned down the left side.
  • In a grid layout, content must be placed within columns and only columns may be immediate children of rows.
  • Thanks to flexbox, grid columns without a specified width will automatically be layed out as equal width columns. For example, four instances of .col-sm will each automatically be 25% wide from the small breakpoint and he others above. See the auto-layout columns section for more examples.
  • Column classes indicate the number of columns you’d like to use out of the possible 12 per row. So, if you want three equal-width columns, you can use .col-sm-4.
  • Column widths are set in percentages, so they’re always fluid and sized relative to their parent element.
  • Columns have horizontal padding to create the gutters between individual columns, however, you can remove themargin from rows and padding from columns by using .no-gutters on the .row.
  • To make the grid responsive, there are five grid breakpoints, one for each responsive breakpoint: all breakpoints (extra small), small, medium, large, and extra large.
  • Grid breakpoints are based on minimum width media queries, meaning they apply to that one breakpoint and all those above it (e.g., .col-sm-4 applies to small, medium, large, and extra large devices, but not the first xs breakpoint).
  • You can use predefined grid classes (like .col-4) or Sass mixins for more semantic markup.
However, please be aware of the limitations and bugs around flexbox, such as the inability to use some HTML elements as flex containers.
--- Posts Merged by Spam-Bot ---
Grid options
While Bootstrap uses ems or rems for defining most sizes, pxs are used for grid breakpoints and container widths. This is because the viewport width is in pixels and does not change with the font size.

You can how aspects of the Bootstrap grid system work across multiple devices with a handy table.
--- Posts Merged by Spam-Bot ---
Auto-layout columns
You can utilize breakpoint-specific column classes for easy column sizing without an explicit numbered class like .col-sm-6.

For example, here are two grid layouts that apply to every device and viewport, from xs to xl. You may add any number of unit-less classes for each breakpoint you need and every column will be the same width.


SN Confirmed Member
New Member
Nice, the bootstrap grid system is easier than the old one
However...since it is using Flex that breaks compatibility with not-so-old browsers. If you still need to support IE, you should stick to BS 3.


New member
New Member
BS4 can be fixed all the way back to IE9 with some workarounds (autoprefixer, HTML5 shiv, and float-based fallbacks for flex) if you really want to use it. Generally though I wouldn't support that dinosaur unless a client specifically needed it. In front end, band-aids are sadly our damn life if we want to use anything remotely current.