Show Output
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Bootstrap 5 Vertical Margin Classes</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> .bs-example{ margin: 20px; border: 1px solid #ccc; } .bs-example div{ padding: 15px; font-size: 18px; background: #dbdfe5; } .bs-example div:nth-child(2n){ background: #abb1b8; } </style> </head> <body> <div class="bs-example"> <div class="my-0">.my-0</div> <div class="my-1">.my-1</div> <div class="my-2">.my-2</div> <div class="my-3">.my-3</div> <div class="my-4">.my-4</div> <div class="my-5">.my-5</div> <div class="my-auto w-50">.my-auto</div> </div> </body> </html>