ShapeYourPath
(current)
Run Code
Live Code Editor- Bootstrap 4 Media Object 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, shrink-to-fit=no"> <!-- Bootstrap CSS --> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css"> <title>Bootstrap Media Object</title> <style type="text/css"> img { width: 150px; height: 150px; } </style> </head> <body> <div class="container text-center mt-4"> <h1 class="text-center">Bootstrap Media Object</h1> <p class="text-center">Bootstrap media object provides functionality to place image either left or right to the content that is exist vertically center to the content. </p> <div class="media"> <img src="https://picsum.photos/200/300" class="rounded img-fluid m-4" alt="Rounded Image" style="width:150px;height:150px;"> <div class="media-body p-2"> <h4 class="mt-0">Media Object:Left Image</h4> <p>This is an example of media object having image in the left direction.</p> </div> </div> <!--media object having image right direction--> <div class="media"> <div class="media-body p-2"> <h4 class="mt-0">Media Object:Right Image</h4> <p>In this example,image is placed right side to the content.</p> </div> <img src="https://picsum.photos/200/300" class="rounded img-fluid m-4" alt="Rounded Image" style="width:150px;height:150px;"> </div> </div> <!--/container--> <!-- jQuery first, then Popper.js, then Bootstrap JS --> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script> </body> </html>
Output :
Running