我保持了父元素的相對位置和子元素的絕對位置,但是當我看到我的chrome殺蟲劑時,它看起來像是在旋轉木馬下。我甚至試圖保持z-index大于其父,但無法解決它
.carousel {
height: 500px;
background-color: #ef8172;
}
.carousel-item {
position: relative;
z-index: -1;
}
.carousel-hope {
position: absolute;
z-index: 100;
}
<section id="testimonial">
<div id="" true " aria-label="Slide 1 "></button>
<button type="button " data-bs-target="#carouselExampleIndicators " data-bs-slide-to="1 " aria-label="Slide 2 "></button>
<button type="button " data-bs-target="#carouselExampleIndicators " data-bs-slide-to="2 " aria-label="Slide 3 "></button>
</div>
<div class="carousel-inner ">
<div class="carousel-item active ">
<div class="carousel-hope ">
<h2 class="messege ">sknff shdfhhcsndfa sbvncsuhf snhfvusdhv sajlfsanvfho</h2>
</div>
</div>
<div class="carousel-item ">
<div class="carousel-hope ">
<h2 class="messege ">sknff shdfhhcsndfa sbvncsuhf snhfvusdhv sajlfsanvfho</h2>
</div>
</div>
<div class="carousel-item ">
<div class="carousel-hope ">
<h2 class="messege ">sknff shdfhhcsndfa sbvncsuhf snhfvusdhv sajlfsanvfho</h2>
</div>
</div>
</div>
<button class="carousel-control-prev " type="button " data-bs-target="#carouselExampleIndicators " data-bs-slide="prev ">
<span class="carousel-control-prev-icon " aria-hidden="true "></span>
<span class="visually-hidden ">Previous</span>
</button>
<button class="carousel-control-next " type="button " data-bs-target="#carouselExampleIndicators " data-bs-slide="next ">
<span class="carousel-control-next-icon " aria-hidden="true "></span>
<span class="visually-hidden ">Next</span>
</button>
</div>
</section>