How to center image in carousel
You've got two options
- If you want the image to take up entire carousel then
img
{
width: 100%;
height: auto;
}
- If you dont want the image to stretch 100 %, then set your desired width(or dont, just specify margin) and margin auto:
img
{
width: 50%;
margin: auto;
}
I know I am super late but in case that someone is searching for an answer today I just found out that for me the best solution was to put the image in a separate div in the .carousel-item
and then center it using flex
:
<div class="carousel-item">
<div class="d-flex justify-content-center">
<img src="img.png" alt="img.png">
</div>
</div>