gpt4 book ai didi

javascript - 幻灯片顶部带有标题的 flexslider

转载 作者:太空宇宙 更新时间:2023-11-03 21:22:50 26 4
gpt4 key购买 nike

我使用的是 flexslider,每张幻灯片都带有标题。这行得通,除了我希望标题位于幻灯片的顶部,而不是底部。我能看到将标题放在顶部的唯一方法是绝对定位它,但是当我这样做时,标题的宽度太宽(数千像素,而不是与父元素一样宽)。

<div class="flexslider">
<ul class="slides">
<li>
<img src="data/homeSlides/brennys.jpg">
<p class="flex-caption">Brenny's Motorcycle Clinic &gt;</p>
</li>
<li>
<img src="data/homeSlides/aledoFireStation.jpg">
<p class="flex-caption">Aledo Fire Protection District &gt;</p>
</li>
<li>
<img src="data/homeSlides/trueNorth.jpg">
<p class="flex-caption">True North &gt;</p>
</li>
<li>
<img src="data/homeSlides/operationThreshold.jpg">
<p class="flex-caption">Operation Threshold &gt;</p>
</li>
<li>
<img src="data/homeSlides/sadler.jpg">
<p class="flex-caption">Sadler &gt;</p>
</li>
</ul>
</div>

CSS:

.flex-caption {
background:rgba(73, 92, 94, 1);
height:50px;
line-height:50px;
margin:0;
text-align:right;
color:#ff5200;
padding-right:20px;
bottom:0;
width:98%;
}

jsFiddle

如何让标题在幻灯片顶部正确显示?

最佳答案

.flex-caption {
background:rgba(73, 92, 94, 1);
height:50px;
line-height:50px;
margin:0;
text-align:right;
color:#ff5200;
padding-right:20px;
top:0;
right:20%; /*Adjust this by yourself to make it look better*/
width:98%;
position:absolute;
}
ul.slides li{
position:relative; /*You need this*/
}
#wrapper{
width:80%;
}

关于javascript - 幻灯片顶部带有标题的 flexslider,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35854593/

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