I need to stack two images on top of each other while ensuring they remain responsive with a percentage width and height.
<div class="container">
<img src="res/bigger.png/>
<img src="res/smaller.png class="icon"/>
</div>
.container {
width:100%;
height:100%;
background-color:blue;
postion:relative;
}
.container img {
max-width:100%;
max-heihgt: 100%;
height: auto;
width: auto;
}
.icon {
position: relative;
top: -70%;
left: 20%;
z-index: 50;
width: 10% !important;
height: auto !important;
}
When resizing the page, the smaller image may lose its position relative to the larger image due to their different proportions. How can I ensure the smaller image remains in the correct position relative to the larger image even when the page is resized?
For a demonstration of this issue, you can visit this link