Introduction
Responsive column classes help your webpage look good on all screen sizes by adjusting the layout automatically.
col-{breakpoint}-{number}col-12
col-md-6
col-sm-4 col-lg-3
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Responsive Columns Example</title> <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet"> </head> <body> <main class="container mt-4"> <section class="row"> <article class="col-12 col-md-6 col-lg-4 bg-primary text-white p-3 mb-3"> Column 1 </article> <article class="col-12 col-md-6 col-lg-4 bg-success text-white p-3 mb-3"> Column 2 </article> <article class="col-12 col-md-12 col-lg-4 bg-warning text-dark p-3 mb-3"> Column 3 </article> </section> </main> </body> </html>
col without a number for equal width columns automatically.col-{breakpoint}-{number} to control column width at different sizes.col-md-6 do in a responsive layout?col-md-6 means the column uses 6 parts out of 12 on medium (≥768px) screens and larger.sm means small screens (≥576px), lg means large screens (≥992px).col-sm-12 col-lg-6 fits.<div class="row"> <div class="col-12 col-md-8">Content A</div> <div class="col-6 col-md-4">Content B</div> </div>
col-md-8 and col-md-4 apply, overriding smaller screen classes.<div class="row"> <div class="col-sm-6 col-md-4">Box 1</div> <div class="col-sm-6 col-md-4">Box 2</div> <div class="col-sm-6 col-md-4">Box 3</div> </div>
col-sm-6, meaning 6 parts out of 12, so two columns fit per row (6+6=12).col-12 makes columns full width on extra small screens (default).col-sm-6 makes two columns per row (6+6=12) on small screens.col-lg-4 makes three columns per row (4+4+4=12) on large screens.Pass the test and this pattern moves unknown