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 Table 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: 5px; border: 1px solid #dee2e6; border-collapse: collapse; } </style> </head> <body> <div class="bs-example"> <h2>Display Table Classes</h2> <p>Use the d-table, d-table-row, and d-table-cell class to force an element to behave like a table, tr and td element, respectively. You can also add breakpoints (sm, md, lg, xl, and xxl) to these classes (d-*-table, d-*-table-row and d-*-table-cell) to control when the element should behave like a table, row or column based on the screen width.</p> <div class="table d-table"> <div class="d-table-row"> <div class="d-table-cell">Cell 1</div> <div class="d-table-cell">Cell 2</div> </div> <div class="d-table-row"> <div class="d-table-cell">Cell 3</div> <div class="d-table-cell">Cell 4</div> </div> </div> </div> </body> </html>