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 Display Inline-block 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; } .bs-example div{ padding: 15px; margin-bottom: 10px; } </style> </head> <body> <div class="bs-example"> <h2>Display Inline-block Classes</h2> <p>Use the d-inline-block class to create a inline-block element. Add breakpoints (sm, md, lg, xl, and xxl) to the classes (d-*-inline-block) to control when the element should be a inline-block element based on the screen width. Resize the browser window to see how it works.</p> <div class="d-inline-block bg-primary">d-inline-block</div> <div class="d-sm-inline-block bg-success">d-sm-inline-block</div> <div class="d-md-inline-block bg-danger">d-md-inline-block</div> <div class="d-lg-inline-block bg-warning">d-lg-inline-block</div> <div class="d-xl-inline-block bg-info">d-xl-inline-block</div> </div> </body> </html>