keepcalculator

06 Numbers and Powers

Bootstrap Column Layouts: Useful Responsive Grids

Card No. 06·8487 · Updated · Standard formula, shown below

Average pace 5.00 min/km
Average speed
12.00 km/h
Result
Finish time
50 min
You entered
Distance
10 km
You entered
You enter
Finish time, Distance
You get
Average pace, Average speed
Rounding
2 dp

Bootstrap column layouts let you build responsive page structures that adapt to any screen size using its 12-column grid system. You define how many columns an element should span at different breakpoints (like col-md-6), and Bootstrap automatically stacks or rearranges them on smaller screens. This article explains the most useful column patterns, how they work, and how to choose the right one for your content.

Formula

The Bootstrap grid is based on a 12-column layout. Each row (.row) is a flex container, and each column (.col-*) is a flex item that can span 1 to 12 of those columns. The formula is simple: the number of columns you assign to each element should add up to 12 per row (unless you use auto-layout). For example, col-6 takes half the width, col-4 takes a third, and col-3 takes a quarter. The actual pixel width is calculated as: width = (span / 12) * container-width, minus the gutter (1.5rem on each side by default).

Worked Example

Suppose you have a container that is 1200px wide (the default lg breakpoint). You create a row with three columns: col-lg-4, col-lg-4, col-lg-4. Each column will be (4/12)*1200 = 400px wide, minus the gutters (which are 24px total per column, so about 376px of content). On a medium screen (768px), if you used col-md-6 for the first two and col-md-12 for the third, the first two would be (6/12)*768 = 384px each, and the third would take the full 768px. On a small phone (576px), with col-sm-12, all three stack vertically at full width.

Background: How the Grid Evolved

Bootstrap’s grid system has been a core feature since version 2, but it changed significantly in version 3 with the introduction of mobile-first classes like col-xs-* (later renamed col-*). Version 4 switched from floats to flexbox, and version 5 added CSS Grid support for advanced layouts. The 12-column system was chosen because it divides evenly by 2, 3, 4, and 6, making it easy to create common layouts like halves, thirds, quarters, and sixths without fractions.

How Breakpoints Work

Bootstrap defines six breakpoints: xs (<576px), sm (≥576px), md (≥768px), lg (≥992px), xl (≥1200px), and xxl (≥1400px). When you write col-md-6, you are saying: “on medium screens and up, take 6 columns; below that, the column will stack to full width unless you also define a lower breakpoint.� The col class without a number is a special auto-layout that fills available space equally. This mobile-first approach means you always define the smallest screen first, then override with larger breakpoints.

Common Useful Layouts

Here are the most practical column patterns you will use repeatedly:

  • Equal thirds: col-md-4 × 3 – ideal for feature boxes, pricing cards, or stats.
  • Two-thirds + one-third: col-lg-8 + col-lg-4 – classic content/sidebar layout.
  • Half + half: col-md-6 × 2 – good for split sections (image + text).
  • Four quarters: col-sm-6 col-lg-3 × 4 – responsive quad layout that becomes 2×2 on tablets, 1 column on phones.
  • Auto-layout: col × any number – equal-width columns without specifying numbers.
  • Offset columns: col-md-6 offset-md-3 – centers a column by leaving 3 empty columns on each side.
  • Nested rows: place a .row inside a column to create sub-columns – useful for complex dashboards.

How to Choose the Right Breakpoints

Start by thinking about the content, not the device. If the content is a short paragraph, it can stay in two columns on a tablet. If it is a long form, it should probably be full width on mobile. A good rule: use col-sm for content that can stay side-by-side on phones (like small cards), col-md for content that needs a bit more room (like forms), and col-lg for large sections like sidebars. Test at 576px, 768px, and 992px to see where the layout breaks. Remember that you can combine breakpoints: col-12 col-md-6 col-lg-4 means full width on phones, half on tablets, and a third on desktops.

Common Mistakes and Misconceptions

One frequent error is forgetting that columns have padding (gutters) by default. If you want no gap, use g-0 on the row. Another mistake is using col-md-6 and expecting it to be half width on a phone – it will be full width because md only applies at 768px and up. Also, do not add more than 12 columns per row; if you do, the extra columns wrap to the next line, which can break your design. A common misconception is that you must use container for the grid to work – actually, container-fluid or even a plain div with .row works, but the container provides the max-width and centering. Finally, remember that the grid is flexbox-based, so vertical alignment can be controlled with align-items-* and justify-content-* classes.

Comparing Bootstrap Grid to Alternatives

Bootstrap’s grid is not the only option. CSS Grid (native) offers more powerful two-dimensional layouts with named areas and explicit row/column tracks. Flexbox is great for one-dimensional layouts (either row or column). The main advantage of Bootstrap’s grid is speed and consistency: you write classes instead of custom CSS, and it handles responsiveness for you. The downside is that you inherit Bootstrap’s opinionated gutter widths and breakpoints, which may not match your design. For simple pages, Bootstrap’s grid is faster; for complex, custom layouts, CSS Grid gives more control.

Performance and Best Practices

Bootstrap’s CSS is about 200KB minified (for the full bundle), but you can reduce that by using only the grid via the custom download or by importing just the grid SCSS file. The grid itself is very performant – flexbox is well-supported and fast. To keep your HTML clean, avoid deeply nested rows; instead, use utility classes like d-flex and flex-wrap for simple alignment. Also, use row-cols-* classes (e.g., row-cols-2 row-cols-md-4) to automatically set the number of columns per row without repeating col-* on each child – this is especially useful for card grids.

Frequently Asked Questions

What is the difference between col and col-auto?

col makes the column take up all available space equally among siblings, while col-auto sizes the column to its content’s width. For example, if you have a row with col and col-auto, the auto column will shrink to wrap its content, and the other column will fill the rest.

How do I center a column horizontally?

Use offset classes, such as col-md-6 offset-md-3, to center a column that spans 6 columns. Alternatively, use mx-auto on the column (if it has a set width) or wrap it in a flex container with justify-content-center.

Can I use the grid without a container?

Yes, you can use .row directly in any block element, but the row will have negative margins that may cause horizontal overflow. It is safer to wrap rows in a .container or .container-fluid to handle the margins properly.

Why are my columns not stacking on mobile?

If you only use col-md-*, the columns will not stack below 768px because they default to col (auto-layout) on smaller screens. Add col-12 (or col-sm-12) to force full width on phones.

What does row-cols do?

row-cols-* sets the number of columns per row automatically. For example, row-cols-2 row-cols-md-4 will display 2 columns on mobile and 4 on desktop, without needing to add col-* classes to each child. This is a shorthand for equal-width columns.

Is the 12-column grid mandatory?

No, you can customize the number of columns in Bootstrap’s SCSS variables (e.g., $grid-columns: 12). You can change it to 16 or 24 if you prefer, but 12 is the default because of its divisibility.

Related

Formula used
in t | Finish time | min | 50 | 0
in d | Distance | km | 10 | 0 | 100000
out pace | Average pace | min/km | t / d | 2
out speed | Average speed | km/h | d / (t / 60) | 2

Each line is one input (in, sel, list) or one result (out: label, unit, formula, decimals). How the calculators work

Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.

More cards in this drawer

The whole Numbers and Powers drawer →