Show Output
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Bootstrap Responsive Text Alignment</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> </head> <body> <div class="m-4"> <p class="text-sm-center">Text will be center aligned on small sized (sm) viewports and up.</p> <p class="text-md-center">Text will be center aligned on medium sized (md) viewports and up.</p> <p class="text-lg-center">Text will be center aligned on large sized (lg) viewports and up.</p> <p class="text-xl-center">Text will be center aligned on extra-large sized (xl) viewports and up.</p> <div class="my-3"><strong>Note:</strong> Open the output in a new blank tab (Click the arrow next to "Show Output" button) and resize the browser window to understand how the Bootstrap responsive text alignment works.</div> </div> </body> </html>