Responsive Grid Classes

Bootstrap Framework 10 min min read Updated: Nov 16, 2026 Beginner
Responsive Grid Classes
Beginner Topic 2 of 7

Why Do We Need Responsive Columns?

A layout with four columns looks great on a laptop but is too tight on a phone. With responsive grid classes, the same HTML shows four columns on a laptop, two on a tablet and one on a phone.

How the Class Names Work

The pattern is col-{breakpoint}-{number}. The breakpoint says from which screen size the number should apply.

ClassApplies FromMeaning
col-6All sizesAlways half width
col-sm-6576pxHalf width from small up, stacked below
col-md-6768pxHalf width from medium up
col-lg-6992pxHalf width from large up
col-xl-61200pxHalf width from extra large up
col-xxl-61400pxHalf width from xxl up
Stacking: Below the chosen breakpoint, columns take the full width and stack one on top of the other. That is the default phone layout.

Example 1: Stack on Phone, Side by Side on Tablet

html <div class="row"> <div class="col-md-6">Left</div> <div class="col-md-6">Right</div> </div>
Result

On a phone, Left is above Right. On a screen 768px or wider they sit side by side.

Example 2: Four Cards Layout

html <div class="row"> <div class="col-12 col-sm-6 col-lg-3">Card 1</div> <div class="col-12 col-sm-6 col-lg-3">Card 2</div> <div class="col-12 col-sm-6 col-lg-3">Card 3</div> <div class="col-12 col-sm-6 col-lg-3">Card 4</div> </div>
ScreenCards per row
Phones (below 576px)1 (col-12)
Small and medium (576px to 991px)2 (col-sm-6)
Large and up (992px+)4 (col-lg-3)

Example 3: Content and Sidebar

html <div class="row"> <main class="col-lg-8">Main content</main> <aside class="col-lg-4">Sidebar</aside> </div>

The sidebar goes below the main content on phones and tablets, and moves to the right side on large screens.

Mixing Classes

You can combine several breakpoints on the same element. Bootstrap applies the largest one that matches the current screen.

html <div class="col-12 col-md-8 col-xl-6"> I am full width on phones, two-thirds on tablets and half on large desktops. </div>

Tips for Choosing Breakpoints

  • Start with the phone layout (no prefix), usually col-12
  • Add md for tablets, where two columns often fit well
  • Add lg for desktops
  • You rarely need all five breakpoints in one element

Common Mistakes

  • Using col-md-6 and expecting the layout to change on phones
  • Writing col-6-md instead of col-md-6 (the prefix order matters)
  • Using too many breakpoint classes, making the code hard to read

Conclusion

Responsive grid classes let one HTML page adapt to every device. Remember to think mobile first and add bigger breakpoints only when the design needs it.

Quick Summary: Use col-{breakpoint}-{number}. Below the breakpoint, columns stack; from the breakpoint up, they use the given width.

Get Newsletter

Subscibe to our newsletter and we will notify you about the newest updates on Edugators