I am trying to superpose images on top of each other inside of a list. One of the images will change depending on in which row it is.
So far, I have been able to move them and look how I want, but I am having two problems:
- The row is not containing the images (meaning that they are overlapping with subsequent rows)
- When I am resizing the window, the desired positioning is altered (makes sense since the images size change)
This is what I have so far:
<div class="container">
<div class="row">
<div class="col-2">
<div class="imageContainer"/>
<img src="http://placehold.it/300x300" id="picture1" />
<img src="http://placehold.it/200x200" id="picture2"/>
</div>
</div>
<div class="col-8">
Some text
</div>
<div class="col-2">
Some more text
</div>
</div>
</div>
With this stylesheet:
.imageContainer{
position:relative;
top:0px;
left:0px;
}
.picture1{
position:absolute;
/*hat size=128px*/
top:60px;
z-index:3;
}
.picture2{
position:absolute;
top: 0px;
left:20px;
z-index:2;
}
Now, if I add a blank image (width=0) after the image container, and I give it the expected height, I am able to solve the first issue. However, if the window is resized, they might not be contained anymore.
What I am trying to achieve is similar to having a picture of a person and a picture of glasses, and trying to put the glasses on top of the person's face (assuming eyes and face are always in the same position in photo).