I'm using a Bootstrap Carousel and am trying to maintain an image within it to stay centered when the window is re-sized (esp. down to mobile size).
The original image is 1600 x 600. I want it to fill the full width of the page in most cases. However, when it goes down to mobile (or iPad-like) size, I want it to have a minimum size of 800 x 300 AND be centered in the carousel.
I've tried the below but two things happen:
The image does not center. It stays aligned to the left and crops the right.
The image weirdly "jumps" between transitions. Right before the transition happens, the image seems to shift breifly/quickly and then transitions.
Here's the css and html:
.carousel-inner img {
width: 100%; max-height: 1800px;
min-height: 300px; min-width: 800px; overflow:hidden;
}
<div id="CarouselHome" class="carousel slide carousel-fade" data-ride="carousel">
<div class="carousel-inner">
<div class="item active">
<img src="img-1.jpg"">
</div>
<div class="item">
<img src="img-2.jpg"">
</div>
<div class="item">
<img src="img-3.jpg"">
</div>
</div>
</div>
I also tried the items in the following link but they didn't work for me: