How to position one div in front of another

1

I tried the following, but it did not work ... it continues with the bottom one staying on top of the top, when it should be the other way around. What am I doing wrong?

.funil{
    text-align:center;
}
.funil_1 { 
    margin-bottom:-20px;
    z-index:4;
}
.funil_2 { 
    margin-bottom:-15px;
    z-index:3;
}
.funil_3 { 
    margin-bottom:-10px;
    z-index:2;
}
.funil_4 { 
    z-index:1;
}

<div class='posts-container funil'>
    <div class="funil_1"><img src="/images/funil_1.png"></div>
    <div class="funil_2"><img src="/images/funil_2.png"></div>
    <div class="funil_3"><img src="/images/funil_3.png"></div>
    <div class="funil_4"><img src="/images/funil_4.png"></div>
</div>

    
asked by anonymous 17.03.2016 / 15:56

1 answer

4

z-index only works for elements with the given position.

Specify the position of the elements to work ...:)

.funil div {
    position: relative;  //(position:absolute, position:relative, ou position:fixed).
}
    
17.03.2016 / 16:23