在图像轮播上添加文本

时间:2013-10-28 20:15:50

标签: jquery html css carousel

我希望将不同段落的文字放在我正在使用的jquery轮播中的幻灯片上。正在使用的html如下;

<div class="slider">
    <ul class="slides">
        <li class="slide">
            <p>example text to sit on top of carousel and change when you click
            through carousel images</p>
            <img src="library/images/item1.jpg" class="imgdivide">
        </li>
        <li class="slide">
            <img src="library/images/item2.jpg" class="imgdivide">
        </li>
        <li class="slide">
            <img src="library/images/item1.jpg" class="imgdivide">
        </li>
        <li class="slide">
            <img src="library/images/item2.jpg" class="imgdivide">
        </li>   
    </ul>
</div>

这就是我目前的造型;

.slider {
    position: relative; 
    width: 100%; 
    height: 50%;
    overflow: hidden;
}

.slides { 
    width: 100%; 
    height: 50%; 
    overflow: hidden;
}

.slide p { 
    width: 100%;
    display: block;
    font-family: Georgia,"Times New Roman", Times, serif;
    size:16px; 
    line-height: 20px; 
    color: #FFF;
}

.slide {
    width: 100%; 
    float: left; 
}

如果有人可以帮助解决这个问题,那将是王牌!

1 个答案:

答案 0 :(得分:1)

使用具有某些z-index的类尝试您的文本。像这样:

    <li class="slide">
        <p class="text-top-image">example text to sit on top of carousel and change when you click
        through carousel images</p>
        <img src="library/images/item1.jpg" class="imgdivide">
    </li>

你的css是这样的:

.text-top-image{
    z-index: 100;
}