I am attempting to align a series of images together, but I seem to have lost the background in the process. I am using "position:absolute" and while the images stack nicely due to their correct sizes, there seems to be an issue with the backgrounds. My goal is to arrange 3 eggs in a row, hence why I have placed the .egg-container inside the .container.
The images: top-egg bottom-egg
.container{
max-width: 50%;
height: auto;
background-color: blue;
margin: 100px auto;
}
.container-egg{
width:21%;
height:auto;
margin: 30px auto;
background-color: red;
position: relative;
}
.bottom{
z-index:2;
}
.top{
z-index:3;
transform: rotate(0deg);
margin-top: -0px;
transition: margin-top .2s;
}
.container-egg:hover > .top{
margin-top: -100px;
transform: translate(10px, 0) rotate(10deg);
}
.position{
width: 100%;
position: absolute;
}
<div class="container">
<div class="container-egg">
<img src="https://i.sstatic.net/fY5Cp.png" class="bottom position">
<img src="https://i.sstatic.net/bQwum.png" class="top position">
</div>
</div>