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 Using Margin Utilities</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-4 ms-auto"> <div class="demo-content bg-alt">.col-md-4 .ms-auto</div> </div> </div> <div class="row"> <div class="col-md-3"> <div class="demo-content">.col-md-3</div> </div> <div class="col-md-3 ms-md-auto"> <div class="demo-content bg-alt">.col-md-3 .ms-md-auto</div> </div> </div> <div class="row"> <div class="col-auto me-auto"> <div class="demo-content">.col-auto .me-auto</div> </div> <div class="col-auto"> <div class="demo-content bg-alt">.col-auto</div> </div> </div> </div> </body> </html>