Skip to content

Grid

The 12-column responsive grid: rows and columns, breakpoints, offsets, ordering, gutters, row columns, nesting and alignment. Tinted boxes show exactly how each column behaves.

1Equal-width columns

Plain col classes share the row width equally, whatever their number.

col
col
col
col
col

2Twelve-column spans

col-* numbers say how many of the 12 columns a column spans.

col-4
col-8
col-3
col-6
col-3
2
col-10

3Breakpoint columns

col-sm-* stacks on phones and goes horizontal from 576px up.

col-sm-4
col-sm-4
col-sm-4

4Mix and match

Different spans per breakpoint: full width, then 8 / 4, then 6 / 6.

col-12 col-md-8 col-xl-6
col-12 col-md-4 col-xl-6
col-6 col-md-4
col-6 col-md-4
col-12 col-md-4

5Auto-width columns

col-auto sizes a column to its content; plain col takes the rest.

col-auto
col - fills the remaining space
col-auto

6Variable width content

col-md-auto fits content from md up while neighbours share the remaining space.

col col-lg-2
Variable width: Be in the room where it happens
col col-lg-2

7Offsets

offset-* pushes a column to the right by a number of grid columns.

col-md-4
offset-md-4
offset-md-3
offset-md-3
col-md-6 offset-md-3

8Order classes

order-* changes the visual order without touching the markup order.

First in DOM, no order
Second in DOM, order-5
Third in DOM, order-1

9First and last

order-first and order-last move single columns to either end, here from md up.

1st - order-md-last
2nd - unordered
3rd - order-md-first

10No gutters

g-0 removes the gaps between columns, useful for image mosaics and tight cards.

g-0
g-0
g-0
g-0

11Gutter sizes

g-*, gx-* and gy-* set both, horizontal or vertical gaps from 0 to 5.

gx-5

col
col

gy-3 (wrapping)

col-6
col-6
col-6
col-6

g-1

col-4
col-4
col-4

12Row columns

row-cols-* sets the number of columns per row on the row itself: 1, 2 then 4.

Item 1
Item 2
Item 3
Item 4
Item 5
Item 6
Item 7
Item 8

13Auto row columns

row-cols-auto lets every column take its natural width and wrap.

guide
design
tips
news
community
release
tutorial

14Nesting

Put a new row inside a column to split it again into 12 columns.

col-sm-3
col-sm-9
nested col-8 col-sm-6
nested col-4 col-sm-6

15Vertical alignment

align-items-start, -center and -end align all columns inside a taller row.

One
Two
Three
One
Two
Three
One
Two
Three

16Horizontal alignment

justify-content-* distributes narrower columns along the row.

start
start
center
center
end
end
between
between
around
around
evenly
evenly

17Self alignment

align-self-* aligns single columns differently from the rest of the row.

align-self-start
align-self-center
align-self-end

18Column wrapping and breaks

Columns over 12 wrap to a new line; a w-100 element forces a break.

col-9
col-4 (wraps)
col-6
col-6 col-sm-3
col-6 col-sm-3
after break
after break

19Margin utilities

ms-auto and me-auto push columns away from each other.

col-md-4
col-md-4 ms-auto
col-auto me-auto
col-auto

20Dashboard layout

A sidebar column and a content column with KPI tiles nested inside - all from the same grid.

Sidebar
col-lg-3
Tickets sold
16.0k
Attendees
27.2k
Sessions
13.5k
Sponsors
86.7k
Chart - col-md-8
Activity - col-md-4