ShapeYourPath
(current)
Run Code
Live Code Editor- Bootstrap 5 Image Center Alignment
Source Code
<!doctype html> <html lang="en"> <head> <!-- Required meta tags --> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <!-- Bootstrap CSS --> <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/css/bootstrap.min.css" rel="stylesheet"> <title>Bootstrap 5 Image Center Alignment</title> </head> <body> <h1 class="text-center">Bootstrap 5 Image Image Center Alignment</h1> <p class="text-justify text-center"> There are mainly two ways to align the image in the center horizontally. Place the image into an external wrapper and assign the .text-center class to it. </p> <img src="https://picsum.photos/seed/picsum/200/300" class="rounded mx-auto d-block" alt="Center alignment"> <!-- Option 1: Bootstrap Bundle with Popper --> <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/js/bootstrap.bundle.min.js"></script> </body> </html>
Output :
Running