简体   繁体   中英

position an element above a slideshow

I ran into some kind of issue recently, I would like to place a png picture above my slideshow, I tried every possible solution I could find/think of but it remains behind or at top but not transparent.

considering how random the display is, I'm guessing it has something to do with the Z-index however I can't seem to understand where the problem comes from.

here is the code : http://jsfiddle.net/6fSAt/6/

<div class="container">
    <img  class"cache" src="http://imageshack.com/a/img822/4694/1gqc.png"/>    

    <div class="cachecontainer">
        <div id="Fader" class="fader">
          <img class="slide" src="http://www.barrelny.com/wp-content/uploads/about-office-slide-pingpong2-800x500.jpg"/>
          <img class="slide" src="http://www.barrelny.com/wp-content/uploads/about-office-slide-bookcase-800x500.jpg"/>
          <img class="slide" src="http://www.barrelny.com/wp-content/uploads/about-office-slide-bikerack-800x500.jpg"/>
        </div>
    </div>  
</div>

body {
width: 100%;
height: 100%;    
}
.cache {
position:absolute;
width:504px;
height:781px;
margin:auto;    
z-index:998;
}

.container {
position:relative;
overflow:hidden;
width:504px;
height:781px;
margin:auto;
background:#FF00FF;
}
.cachecontainer {
position:absolute;
}

.fader{
padding-top: 60%;
} 

.fader .slide{
position: absolute;
width: 100%;
height: 100%;
top: 0;
z-index: 1;
opacity: 0;
}

.fader img.slide{
height: auto;
}

Use position: absolute; and z-index; on the image you want to have on top.

div.container img {
    position: absolute;
    z-index: 100;
}

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