I attempted to horizontally center an image by applying the class justify-content-center
to the parent div, along with text-center
.
Although this method worked for text, the image remained aligned to the left instead of being centered. How can I correct this issue?
.thumbnail {
cursor: pointer;
height: 10em;
width: 10em;
-webkit-user-select: none;
-ms-user-select: none;
user-select: none;
box-sizing: content-box;
}
.thumbnail > img {
max-height: 10em;
max-width: 10em;
}
<link href="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="55373a3a21262127342515607b657b67">[email protected]</a>/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<div class="row justify-content-md-center">
<div class="col col-md-4 d-flex justify-content-center text-center">
<a href="/characters/pine">
<div class="thumbnail align-text-bottom text-center">
<img class="center-block" src="https://media.gettyimages.com/id/157615990/photo/lasagna.jpg?s=612x612&w=gi&k=20&c=ue-VP7TbzbfT-KUHdhUz5T9CPBGteCiTESjiqA8CVHw=">
</div>
<div>Pineapple Lasagna Coleslaw</div>
</a>
</div>
</div>