Bootstrap ยท Chapter 5 of 43

Bootstrap Grid Breakpoints

Breakpoints let you change column widths at different screen sizes, which is the key to responsive design. Bootstrap defines breakpoints named sm, md, lg, xl and xxl, each tied to a minimum viewport width.

You combine a breakpoint with a column class, like .col-md-6, meaning the column takes 6 of 12 units starting at the medium breakpoint and up. Below that breakpoint, it usually falls back to full width.

Syntax
<div class="col-12 col-md-6 col-lg-4">...</div>

Breakpoint sizes

sm starts at 576px, md at 768px, lg at 992px, xl at 1200px, and xxl at 1400px. Classes without a breakpoint name apply to all screen sizes (extra small and up).

Combining breakpoints

You can stack multiple breakpoint classes on one column, such as col-12 col-md-6 col-lg-4, to change its width at different screen sizes for a fully responsive layout.

Example 1 (html)
<div class="container">
  <div class="row">
    <div class="col-12 col-md-6 bg-info text-white">Half on medium+</div>
    <div class="col-12 col-md-6 bg-dark text-white">Half on medium+</div>
  </div>
</div>
Output
Full-width stacked columns on phones, side-by-side halves on tablets and up

col-12 makes each column full width by default, and col-md-6 overrides that to half-width from md upward.

Example 2 (html)
<div class="row">
  <div class="col-6 col-lg-3 bg-secondary text-white">Quarter on lg+</div>
</div>
Output
The column takes half the row on small screens, one quarter on large screens

As the screen grows past the lg breakpoint, the column class overrides the smaller one.

Key points

  • Breakpoints: sm (576px), md (768px), lg (992px), xl (1200px), xxl (1400px).
  • Classes without a breakpoint apply to all sizes.
  • You can stack multiple breakpoint classes for full responsiveness.
  • Larger breakpoint classes override smaller ones as the screen grows.
๐Ÿ’ก Note: Design mobile-first: start with col-12 for small screens, then add larger breakpoint classes to change layout on bigger screens.

๐Ÿ“ Quick Quiz

1. What does col-md-6 mean?

2. Which breakpoint starts at 992px?

3. What approach does Bootstrap's grid encourage?