I'm trying to display a Carousel component behind some text so that there are scrolling/fading images with a large header over the top. I'm trying to wrap all of this in a div so that the carousel images aren't the background for the entire page, only this title section.
I've found this post from 2013 but things have changed a lot. I've tried adapting it but it just doesn't show up at all, even after fiddling with overflow: hidden
stuff in Firefox debugger.
How would I go about displaying a series of images (carousel) behind text, in a div, in Bootstrap 5?
Edit: here's the code I've adapted from the linked SO post.
<div class="col-xl-10 offset-xl-1 rounded">
<div id="titleCarousel" class="carousel slide carousel-fade" data-bs-ride="carousel">
<div class="carousel-inner">
<div class="carousel-item active" id="c-one"></div>
<div class="carousel-item" id="c-two"></div>
<div class="carousel-item" id="c-three"></div>
</div>
</div>
<div class="row">
<h1 class="text-center">Title Text</h1>
</div>
</div>
.carousel {
z-index: -99;
} /* keeps this behind all content */
.carousel-item {
position: fixed;
width: 100%;
height: 100%;
-webkit-transition: opacity 1s;
-moz-transition: opacity 1s;
-ms-transition: opacity 1s;
-o-transition: opacity 1s;
transition: opacity 1s;
}
#c-one {
background: url(../images/front_2.jpg);
background-size: cover;
-moz-background-size: cover;
}
#c-two {
background: url(../images/front_3.jpg);
background-size: cover;
-moz-background-size: cover;
}
#c-three {
background: url(../images/front_4.jpg);
background-size: cover;
-moz-background-size: cover;
}
.carousel .active .left {
left: 0;
opacity: 0;
z-index: 2;
}