Create a responsive three column layout with Bootstrap

Description: Create three columns. On small screens they must be stacked (full width), and from the medium breakpoint they must be side by side.

Hint:

  • Use container, row and col-12 col-md-4.

Solution

<div class="container text-center">
  <div class="row g-2">
    <div class="col-12 col-md-4"><div class="p-3 border bg-light">Column 1</div></div>
    <div class="col-12 col-md-4"><div class="p-3 border bg-light">Column 2</div></div>
    <div class="col-12 col-md-4"><div class="p-3 border bg-light">Column 3</div></div>
  </div>
</div>
Live preview

How it works

  • col-12 gives the full width on small screens, and col-md-4 gives 4 of 12 columns from 768px.
  • g-2 adds a small gutter between the columns.

Read Grid System.


Learn more about the similar topics:
Tutorials
Bootstrap Containers
Bootstrap Grid System
Bootstrap Grid: Gutters, Offset, Order and Nesting
Bootstrap Layout Example: Landing Page
Exercises & Assignments
Create a responsive three column layout with Bootstrap
Create a responsive grid of six cards
Interview Questions & Answers
What is the Bootstrap grid system?
What are the breakpoints in Bootstrap 5?
What is the difference between container and container-fluid?
What are row and col classes in Bootstrap?
What is the viewport meta tag and why is it needed for Bootstrap?
What is the mobile first approach in Bootstrap?
What are gutters in the Bootstrap grid?