简体   繁体   English

绝对位置:我不能将文字放在CSS3幻灯片的底部

[英]Absolute position: I can't put my text at the bottom of my CSS3 slideshow

I know that it is possible to put a text at the bottom of a block by using the absolute position and adding "bottom: 0;", but impossible for me. 我知道可以通过使用绝对位置并添加“ bottom:0;”将文本放在块的底部,但这对我来说是不可能的。 I try for a long time, but I can't. 我尝试了很长时间,但是不能。 I am currently working on a slideshow in CSS3 and I grouped my 4 pictures in absolute position. 我目前正在CSS3中制作幻灯片,我将4张图片按绝对位置分组。

Here is my HTML code: 这是我的HTML代码:

<h1 id="welcome-to">Welcome to! Web site for highly customized styles for the <a href="http://xenforo.com" target="_blank" style="border-bottom: 2px solid;">XenForo forum software</a>.</h1>
<h1 id="all-available-styles">All available styles</h1>
<div id="slideshow">
    <div id="slideshow-container">
        <div class="slideshow-content">
            <img src="images/image-1.jpg" alt="Image 1">
            <span>First Image</span>
        </div>
        <div class="slideshow-content">
            <img src="images/image-2.jpg" alt="Image 2">
            <span>Second Image</span>
        </div>
        <div class="slideshow-content">
            <img src="images/image-3.jpg" alt="Image 3">
            <span>Third Image</span>
        </div>
        <div class="slideshow-content">
            <img src="images/image-4.jpg" alt="Image 4">
            <span>Fourth Image</span>
        </div>
    </div>
</div>

and my slideshow CSS code: 和我的幻灯片CSS代码:

#slideshow
{
    text-align: center;
    height: 440px;
}

#slideshow #slideshow-container
{
    position: relative;
}

#slideshow #slideshow-container img
{
    position: absolute;
    right: 0;
    left: 0;
    margin: 0 auto;
    pointer-events: none;
}

#slideshow #slideshow-container span
{
    position: absolute;
    right: 0;
    left: 0;
    font-size: 15px;
}

I use a span to surround my text and adding "bottom: 0;" 我用一个跨度围住我的文本并添加“ bottom:0;”。 to: 至:

#slideshow #slideshow-container span
{
    position: absolute;
    right: 0;
    left: 0;
    bottom: 0;
    font-size: 15px;
}

The text remains attached to the top: http://i.stack.imgur.com/SyzTL.png 文本保留在顶部: http : //i.stack.imgur.com/SyzTL.png

How can I do, please? 请问我该怎么办?

this will work for you i think. 我认为这将为您工作。

#slideshow #slideshow-container {
position: static;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM