After reading some answers on stack I managed to make a div overlay for my youtube video. The description said it would let me add as many divs in the constructed div, which made sense to me.
However, the second div I put in there is pushing down my video. I tried tweaking with the position and z-index but this didn't help. Why is only one of the divs pushing the video down? Shouldn't the parent div make sure they both hover over the video?
(btw, the second div will be hidden later with jquery, so that the first div can open it by clicking on it.)
I wrapped the video overlay in containers:
.outer-container {
width:68%;
height:575px;
margin-left:2%;
background-color:#97D3A3;
display:inline-block;
}
.inner-container {
display: inline-block;
position: relative;
width: 100%;
height: 100%;
}
.video-overlay {
width:100%;
}
.video {
width: 100%;
height: 100%;
}
.overlaycontent {
width:100%;
height:100%;
background-color:#fff;
color:#000;
position: relative;
z-index: 98;
}
.overlayinfo {
position: relative;
z-index: 99;
height: 0px;
border-top: 4px solid #F1860B;
width:100%;
max-width:816px;
text-align:center;
}
.overlayinfo img {
margin:0px auto;
width:53px;
}
And this is my HTML:
<div class="outer-container">
<div class="inner-container">
<div class="video-overlay">
<div class="overlayinfo">
<a href="#" class="infotrigger"><img src="#"></a>
</div>
<div class="overlaycontent">
Lorem ipsum dolor sit amet
</div>
</div>
<iframe class="video" width="100%" height="100%" src="https://www.youtube.com/embed/6ttrZ11csfI?autoplay=1&controls=0&loop=1&playlist=6ttrZ11csfI&showinfo=0&modestbranding=1" frameborder="0"></iframe>
</div>
</div>
Here is a fiddle to see the complete picture: https://jsfiddle.net/boe5xLte/2/