Skip to main content

Bootstrap Columns to CSS Grid & Flexbox

A practical cheat sheet for translating Bootstrap grid columnscol-md-6, col-4, offset-*, order-* — into modern CSS Grid and Flexbox. Use it to modernise a legacy layout, to understand what a Bootstrap class actually does, or to rebuild a page with the UnysonPlus Div (which outputs clean flex/grid CSS instead of grid classes).

The one thing to understand first

Bootstrap's grid IS flexbox underneath. A .row is display:flex; flex-wrap:wrap, and each col-* is just a flex-basis percentage. So most of this page is simply recognising what a Bootstrap class already maps to in raw CSS — and where CSS Grid does the same job with less math.

The structural pieces

BootstrapCSS FlexboxCSS GridUnysonPlus Div
.containermax-width + margin-inline:automax-width + margin-inline:autoContent Width option
.rowdisplay:flex; flex-wrap:wrapdisplay:grid; grid-template-columns:…Display = Flex / Grid
.col-*a flex child with a flex-basisa grid item (grid-column: span N)a child Div's Width preset
gutters (column padding)gapgapGap
.col (no number)flex: 1 1 0 (equal fill)a 1fr trackAuto width / Grow to Fill

The full 12-column width map

Every Bootstrap column width is N / 12. Here is the complete translation to a percentage, a Flexbox flex-basis, a CSS Grid span, and the UnysonPlus Div width preset:

BootstrapFractionWidth %Flexbox flexCSS GridDiv preset
col-11/128.333%flex: 0 0 8.333%grid-column: span 11
col-21/616.667%flex: 0 0 16.667%span 22
col-31/425%flex: 0 0 25%span 33
col-41/333.333%flex: 0 0 33.333%span 44
col-55/1241.667%flex: 0 0 41.667%span 55
col-61/250%flex: 0 0 50%span 66
col-77/1258.333%flex: 0 0 58.333%span 77
col-82/366.667%flex: 0 0 66.667%span 88
col-93/475%flex: 0 0 75%span 99
col-105/683.333%flex: 0 0 83.333%span 1010
col-1111/1291.667%flex: 0 0 91.667%span 1111
col-121/1100%flex: 0 0 100%span 1212
note

This exact map is what the UnysonPlus Site Converter uses when it rebuilds a source's rows as flex Div rows — a source col-md-6 (or a measured 50% column) becomes a Div cell with width preset 6. See Column widths & the grid.

Everything beyond width

BootstrapFlexboxCSS Grid
offset-3margin-left: 25%grid-column-start: 4
order-2 / order-lastorder: 2order: 2
align-items-center (on .row)align-items: centeralign-items: center
justify-content-betweenjustify-content: space-betweenjustify-content: space-between
align-self-end (on a column)align-self: endalign-self: end
a row of 3 that wrapsflex-wrap: wrap + basis 33.3%grid-template-columns: repeat(3, 1fr)
equal-height columnsautomatic (flex stretches)automatic (grid stretches)

Notice that the alignment property names are identical across Bootstrap utilities, Flexbox and Grid — align-items, justify-content, align-self all carry over unchanged.

Flexbox vs CSS Grid — which to use

The most common question when leaving Bootstrap behind is "flexbox or grid?" A simple rule:

You want…UseWhy
A row that wraps to the next line when fullFlexboxitems keep their size and flow naturally
N equal columns (a true column layout)CSS Gridrepeat(N, 1fr) — no percentage math, no wrap surprises
Items sized by their content (nav bar, tags, buttons)Flexboxflex: 0 0 auto or flex: 1 per item
A two-dimensional layout (rows and columns aligned)CSS Gridgrid aligns both axes; flex controls only one
An uneven split like 8 / 4eitherGrid: span 8 + span 4; Flex: basis 66.7% + 33.3%

Rule of thumb: Flexbox is for one-dimensional flows (a row or a stack). CSS Grid is for two-dimensional layouts and for real "columns."

The display property: flex, grid, or block?

Bootstrap hides one CSS property behind its grid: display. It is the single most important layout property in CSS — it decides how an element arranges its children. When you build with a container (like the UnysonPlus Div) you choose it directly. There are three values you will reach for:

displayWhat it doesReach for it when…Related properties
flexLays children along one axis — a row (side by side) or a column (stacked). They can wrap, grow and shrink.You want a row or a stack: nav bars, button groups, cards that wrap.flex-direction, flex-wrap, justify-content, align-items, gap
gridArranges children into a two-dimensional grid of columns (and rows).You want real columns: a card grid, a gallery, N aligned columns.grid-template-columns, gap, justify-content, align-items
blockNormal document flow — each child stacks top-to-bottom on its own line (the default for a <div>).You just want a plain wrapper and will let content flow normally.(none — children simply flow)

The mental model:

  • flex = one-dimensional → "a row or a stack."
  • grid = two-dimensional → "N aligned columns." — the modern answer to "I want columns."
  • block = no layout → "just flow, top to bottom."
In the UnysonPlus Div

The Div's Display option is exactly this CSS display property — Flex, Grid or Block. Choose Grid and set Grid Columns for a column layout; Flex for a one-dimensional row or stack; Block for a plain content wrapper. For an uneven split like 1/3 + 2/3, use Grid with grid-template-columns: 1fr 2fr.

Quick answers

What is the CSS Grid equivalent of col-md-6? A grid item spanning half the tracks — grid-column: span 6 inside a 12-track grid, or simply one cell of a grid-template-columns: repeat(2, 1fr) grid. As a width it is 50%.

What is col-4 in flexbox? flex: 0 0 33.333% on the column, inside a display:flex; flex-wrap:wrap row.

How do I make 3 equal columns without Bootstrap? display:grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; — that's it. No fraction classes, no .row wrapper math.

Do I still need a .container? Conceptually yes — you still want a centred max-width. In CSS that's max-width + margin-inline:auto; in the UnysonPlus Div it is the Content Width option.

How do offsets work without offset-*? Flexbox: margin-left (a percentage). CSS Grid: place the item with grid-column-start.

How this maps to the UnysonPlus Div

The UnysonPlus Div (a flexbox/grid container) is the modern replacement for Section → Row → Column authoring:

  • Set the Div's Display to Grid and choose how many columns — that is your .row of equal col-* cells, output as clean CSS Grid.
  • Set the Div's Display to Flex for one-dimensional rows and stacks that wrap.
  • Each child Div's Width preset is the N from col-N (see the map above).
  • Content Width gives you the .container (centred max-width).

The classic Section/Row/Column grid stays fully supported for existing pages — see the Page Builder Roadmap for how the two coexist.

See also