简体   繁体   中英

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. 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.

Here is my HTML code:

<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:

#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;" 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

How can I do, please?

this will work for you i think.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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