Bootstrap 5 Grid System
Use our powerful mobile-first flexbox grid to build layouts of all shapes and sizes thanks to a twelve column system, six default responsive tiers, and dozens of predefined classes.
Equal Width Columns
Auto LayoutFor example, here are two grid layouts that apply to every device and viewport, from xs to xxl. Add any number of unit-less classes for each breakpoint you need and every column will be the same width.
.col
.col
.col
.col
.col
Setting One Column Width
FlexibleAuto-layout for flexbox grid columns also means you can set the width of one column and have the sibling columns automatically resize around it.
.col
.col-6
.col
.col
.col-5
.col
Variable Width Content
Auto-sizingUse col-{breakpoint}-auto classes to size columns based on the natural width of their content.
.col .col-lg-2
.col-md-autoVariable width content
.col .col-lg-2
Responsive Classes
BreakpointsBootstrap's grid includes six tiers of predefined classes for building complex responsive layouts.
.col-12 .col-sm-6 .col-md-4 .col-lg-3 .col-xl-2
.col-12 .col-sm-6 .col-md-8 .col-lg-9 .col-xl-10
.col-6 .col-md-4
.col-6 .col-md-4
.col-6 .col-md-4
Vertical Alignment
FlexboxUse flexbox alignment utilities to vertically and horizontally align columns.
.align-items-start
.align-items-start
.align-items-start
.align-items-center
.align-items-center
.align-items-center
.align-items-end
.align-items-end
.align-items-end
Column Wrapping
Auto-wrapIf more than 12 columns are placed within a single row, each group of extra columns will, as one unit, wrap onto a new line.
.col-9
.col-4Since 9 + 4 = 13 > 12, this 4-column-wide div gets wrapped onto a new line as one contiguous unit.
.col-6Subsequent columns continue along the new line.
Column Breaks
w-100Breaking columns to a new line in flexbox requires a small hack: add an element with width: 100% wherever you want to wrap your columns to a new line.
.col-6 .col-sm-3
.col-6 .col-sm-3
.col-6 .col-sm-3
.col-6 .col-sm-3
Order Classes
Flexbox OrderUse .order- classes for controlling the visual order of your content.
.order-3
.order-1
.order-2
Offsetting Columns
OffsetMove columns to the right using .offset-md-* classes. These classes increase the left margin of a column by * columns.
.col-md-4
.col-md-4 .offset-md-4
.col-md-3 .offset-md-3
.col-md-3 .offset-md-3
.col-md-6 .offset-md-3
Nesting
Nested GridsTo nest your content with the default grid, add a new .row and set of .col-sm-* columns within an existing .col-sm-* column.
.col-sm-3
.col-sm-9.col-8 .col-sm-6
.col-4 .col-sm-6