Hi I am trying to get a list of images placed one below other and on top of each image there is some text. I thought of this layout. I have a main wrapper with relative positioning which contains a img-txt div this also has relative positioning. and then this contains two divs one for image and other for text. But my images are stacked on top of each other why?
.wrapper{
position:relative;
}
.img-txt{
position: relative;
}
.iimg{
position: absolute;
}
.text{
position: absolute;
}
<div class="wrapper">
<div class="img-txt">
<div class="iimg">
<img src="http://img.youtube.com/vi/rMcW62wx1Qk/mqdefault.jpg"/>
</div>
<div class = "text">Test</div>
</div>
</div>
<div class="wrapper">
<div class="img-txt">
<div class="iimg">
<img src="http://img.youtube.com/vi/rMcW62wx1Qk/mqdefault.jpg"/>
</div>
<div class = "text">Test</div>
</div>
</div>
<div class="wrapper">
<div class="img-txt">
<div class="iimg">
<img src="http://img.youtube.com/vi/rMcW62wx1Qk/mqdefault.jpg"/>
</div>
<div class = "text">Test</div>
</div>
</div>
<div class="wrapper">
<div class="img-txt">
<div class="iimg">
<img src="http://img.youtube.com/vi/rMcW62wx1Qk/mqdefault.jpg"/>
</div>
<div class = "text">Test</div>
</div>
</div>
position: relative;on the<li>of that list, and use some sort of container for the text inside (<span>springs to mind), and position that withposition: absolute;<div>s.