Utilizing Bootstrap 4 carousel, I am attempting to center an image both vertically and horizontally. Below is my code along with the styling that I have applied:
<div id="myCarousel" class="carousel slide" data-ride="carousel">
<ul class="carousel-indicators">
<li data-target="#myCarousel" data-slide-to="0" class="active"></li>
<li data-target="#myCarousel" data-slide-to="1"></li>
<li data-target="#myCarousel" data-slide-to="2"></li>
</ul>
<div class="carousel-inner">
<div class="carousel-item active">
<img src="https://placehold.it/200x200/c0392b/000">
</div>
</div>
<a class="carousel-control-prev" href="#myCarousel" role="button" data-slide="prev">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a class="carousel-control-next" href="#myCarousel" role="button" data-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>
#myCarousel {
height: 100%;
width: 100%;
}
.carousel-indicators {
margin-bottom: 8px;
}
.carousel-indicators>li {
width: 10px;
height: 10px;
border-radius: 100%;
}
.carousel-inner {
height: 100%;
background-color: #213B74;
}
.carousel-item {
text-align: center;
}
.carousel-item img {
display: block;
margin: auto;
}
Currently, there is only one carousel item for testing purposes. The image is centered horizontally, but even after setting the display attribute of the image to block and its margin to auto, it remains uncentered vertically. Can someone please point out what error I may be making?
I have gone through similar questions, yet none have provided the solution I seek. If this question duplicates another, kindly direct me to the relevant answer.
Thank you.