I'm currently working on creating a carousel that will serve as a background image cover for my website, similar to the revolutionary slider in WordPress but without using a plugin. I am developing it specifically for my static website. The challenge I am facing is that some of my images have different heights and widths, causing the carousel not to adjust properly. For instance, img no. 1 has dimensions of 2048x3072px, while the 2nd image has dimensions of 3072x2048px, and so on. My goal is to make the height and width of the carousel 100% like a cover image. However, when I set the min-width and height to be 100% and 100vh respectively, the images get cropped from the bottom. Can anyone provide assistance with this issue? Here is my code:
<!--carousel-->
<div id="myCarousel" class="carousel slide" data-ride="carousel">
<!-- Indicators -->
<ol 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>
<li data-target="#myCarousel" data-slide-to="3"></li>
</ol>
<!-- Wrapper for slides -->
<div class="carousel-inner" role="listbox">
<div class="item active">
<img class ="fill"src="img/msp_0409_3522.jpg" alt="Chania">
</div>
<div class="item">
<img class ="fill" src="img/msp_0406_1786.jpg" alt="Chania">
</div>
<div class="item">
<img class ="fill" src="img/msp_1608_9566.jpg" alt="Flower">
</div>
<div class="item">
<img class ="fill" src="img/msp_1605_6918.jpg" alt="Flower">
</div>
</div>
<!-- Left and right controls -->
<a class="left carousel-control" href="#myCarousel" role="button" data- slide="prev">
<span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a class="right carousel-control" href="#myCarousel" role="button" data- slide="next">
<span class="glyphicon glyphicon-chevron-right" aria-hidden="true"> </span>
<span class="sr-only">Next</span>
</a>
</div>
CSS
html,body{
height:100%;
}
.carousel,.item,.active{
height:100%;
}
.carousel-inner{
height:100%;
}
.fill{
width:100%;
height:100%;
background-position:center;
background-size:cover;
}