Show Output
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Bootstrap Columns Offsetting</title> <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet"> <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js"></script> <style> /* Some custom styles to beautify this example */ .demo-content{ padding: 15px; font-size: 18px; background: #dbdfe5; margin-bottom: 10px; } .demo-content.bg-alt{ background: #abb1b8; } </style> </head> <body> <div class="container mt-3"> <div class="row"> <div class="col-md-4"> <div class="demo-content">.col-md-4</div> </div> <div class="col-md-8"> <div class="demo-content bg-alt">.col-md-8</div> </div> </div> <div class="row"> <div class="col-md-8 offset-md-4"> <div class="demo-content bg-alt">.col-md-8 .offset-md-4</div> </div> </div> <hr> <div class="row"> <div class="col-md-3"> <div class="demo-content">.col-md-3</div> </div> <div class="col-md-9"> <div class="demo-content bg-alt">.col-md-9</div> </div> </div> <div class="row"> <div class="col-md-6 offset-md-3"> <div class="demo-content bg-alt">.col-md-6 .offset-md-3</div> </div> <div class="col-md-3"> <div class="demo-content">.col-md-3</div> </div> </div> <hr> <div class="row"> <div class="col-md-3"> <div class="demo-content">.col-md-3</div> </div> <div class="col-md-3"> <div class="demo-content bg-alt">.col-md-3</div> </div> <div class="col-md-3"> <div class="demo-content">.col-md-3</div> </div> <div class="col-md-3"> <div class="demo-content bg-alt">.col-md-3</div> </div> </div> <div class="row"> <div class="col-md-3 offset-md-3"> <div class="demo-content bg-alt">.col-md-3 .offset-md-3</div> </div> <div class="col-md-3 offset-md-3"> <div class="demo-content">.col-md-3 .offset-md-3</div> </div> </div> </div> </body> </html>