I have a pin (red dot) over the image that has a percentage position set.
How can I retain the pin position relative to the image when re-sizing the parent wrap container? (resize the wrap container to see the issue)
#wrap{
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
}
.pin{
width:50px;
height:50px;
background:red;
position:absolute;
left:40%;
top:40%;
}
img{
display:block;
width:100%;
}
<div id="wrap">
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/c/c8/Altja_j%C3%B5gi_Lahemaal.jpg/1200px-Altja_j%C3%B5gi_Lahemaal.jpg"/>
<div class="pin"></div>
</div>
I tried making it seamless but due to time constraints, I couldn't give my best shot. However, the
pinisrelativewhen resizing thewrapvertically and horizontally. Not sure how much I helped you with this.Note: You can restrict the resizing up to a certain limit (minimum width and height) so that the
pindoes not go out of the image when a user tries to resize thewrapto almost "zero(0) dimensions".