gpt4 book ai didi

html - 容器外的 Bootstrap 旋转木马标题

转载 作者:行者123 更新时间:2023-11-28 05:46:32 25 4
gpt4 key购买 nike

有没有办法将图片容器外的标题放在一边?我尝试在 .carousel-caption 上添加 position: relative 但这仅在我想将其放在图像下方时才有效。我还尝试将 overflow: visible 添加到 .carousel-inner 中,虽然这确实有效,但每当幻灯片发生变化时,其他图像也会出现在背景中。

现在我只是在做 position: absolute 来定位它,但是你可以看到标题被图像容器截断了。

这是我使用的基本结构:

<div id="featured-news" class="carousel slide" data-ride="carousel">

<!-- Wrapper for slides -->
<div class="carousel-inner" role="listbox">
<div class="item active">
<img class="img-responsive" src="images/banner-img.jpg" alt="Banner">
<div class="carousel-caption">
<h3>Lorem Ipsum dolor Sit Amet</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua Ut enim ad minim veniam</p>
<img src="images/divider.png" alt="Divider">
<p class="posted">Posted by MrDoom on April 15, 2011</p>
</div>
</div>

<div class="item">
<img class="img-responsive" src="images/banner-img.jpg" alt="Banner">
<div class="carousel-caption">
<h3>Lorem Ipsum dolor Sit Amet</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua Ut enim ad minim veniam</p>
<img src="images/divider.png" alt="Divider">
<p class="posted">Posted by MrDoom on April 15, 2011</p>
</div>
</div>

<div class="item">
<img class="img-responsive" src="images/banner-img.jpg" alt="Banner">
<div class="carousel-caption">
<h3>Lorem Ipsum dolor Sit Amet</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua Ut enim ad minim veniam</p>
<img src="images/divider.png" alt="Divider">
<p class="posted">Posted by MrDoom on April 15, 2011</p>
</div>
</div>
</div>

<!-- Left and right controls -->
<a class="left carousel-control" href="#featured-news" role="button" data-slide="prev">
<img src="images/arrows-left.png" alt="Left arrows">
<span class="sr-only">Previous</span>
</a>
<a class="right carousel-control" href="#featured-news" role="button" data-slide="next">
<img src="images/arrows-right.png" alt="Right arrows">
<span class="sr-only">Next</span>
</a>
</div>

The problem

最佳答案

.carousel-caption {
position: relative;
left: auto;
right: auto;
}

只需在您的代码中添加此 CSS 即可解决此问题。

关于html - 容器外的 Bootstrap 旋转木马标题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37573809/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com