I’ve been working with the following code: Bootstrap-4-carousel-text-only
I’m experiencing problems with the carousel content when resizing it down to smaller screens.
If I stick to just a few words inside the h3 tags as in the first slide example the carousel content displays okay on smaller screens, but when I add more text as in the second slide example, the carousel content becomes truncated halfway down on smaller screens. I can get around this by increasing the height of the carousel-inner and all of my content becomes visible again on smaller screens, but I am then left with a larger area of unnecessary space below the bottom of the content on laptops and desktops.
Is there a simple way to adapt the existing code so as to make the carousel height expand and contract in both larger and smaller screen sizes depending on the available content?
Any constructive advice would be greatly appreciated.
body{
background-color: #000;
}
.carousel{
margin-top: 50px;
}
.carousel-inner{
height: 150px;
}
.carousel-caption{
color: #fff;
top: 50%;
}
<div id="carouselExampleControls" class="carousel slide" data-ride="carousel">
<div class="carousel-inner">
<div class="carousel-item active">
<div class="carousel-caption">
<h3>Boyd W.</h3>
<p>TEXT</p>
</div>
</div>
<div class="carousel-item">
<div class="carousel-caption">
<h3>Diane L</h3>
<p>« Lorem ipsum dolor sit amet, consectetur adipisci elit, sed eiusmod tempor incidunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur.» </p>
</div>
</div>
<div class="carousel-item">
<div class="carousel-caption">
<h3>Randall L</h3>
<p>TEXT</p>
</div>
</div>
<div class="carousel-item">
<div class="carousel-caption">
<h3>John D.</h3>
<p>TEXT</p>
</div>
</div>
<div class="carousel-item">
<div class="carousel-caption">
<h3>Jody B.</h3>
<p>TEXT</p>
</div>
</div>
</div>
<a class="carousel-control-prev" href="#carouselExampleControls" 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="#carouselExampleControls" role="button" data-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>