Grid System Practice Examples

Interactive practice layouts based entirely on the official Bootstrap Grid documentation.

Equal-width

For example, here are two grid layouts that apply to every device and viewport, from xs to xl.

1 of 2
2 of 2
1 of 3
2 of 3
3 of 3

Setting one column width

Auto-layout for flexbox grid columns also means you can set the width of one column and have the sibling columns automatically resize around it.

1 of 3
2 of 3 (Wider / .col-6)
3 of 3
1 of 3
2 of 3 (Wider / .col-5)
3 of 3

Variable width content

Use col-{breakpoint}-auto classes to size columns based on the natural width of their content.

1 of 3
Variable width content
3 of 3
1 of 3
Variable width content
3 of 3

Responsive classes

Bootstrap’s grid includes five tiers of predefined classes for building complex responsive layouts.

All breakouts (Stack to horizontal)

Using a single set of .col-sm-* classes, you can create a basic grid system that starts stacked on extra small devices before becoming horizontal on desktop (small) devices.

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

Mix and match

Don’t want your columns to simply stack in some grid tiers? Use a combination of different classes for each tier as needed.

.col-sm-8 .col-md-8
.col-6 .col-md-4
.col-6 .col-sm-4
.col-6 .col-sm-4
.col-6 .col-sm-4

Alignment

Use flexbox alignment utilities to vertically and horizontally align columns.

Vertical Alignment

Top aligned col
Top aligned col
Center aligned col
Center aligned col
Bottom aligned col
Bottom aligned col

Horizontal Alignment

One of two (Start)
Two of two (Start)
One of two (Center)
Two of two (Center)
One of two (End)
Two of two (End)

Reordering

Use .order- classes for controlling the visual order of your content.

First in markup, but ordered LAST
Second in markup, unordered
Third in markup, but ordered FIRST