Is it possible to ensure that a .png image is always centered in a div, regardless of the device size, and appears above another .png image within the same div? Below is the HTML code snippet:
<div class="col-sm-6">
<div id="spinningDial">
<img src="redphone.png" id="phone"/>
<img src="RadialSlime.png" id="radial" class="rotate" style="width: 100%;">
</div>
</div>
Here is the corresponding CSS:
#phone {
position: absolute;
left: 67%;
top: 45%;
z-index: 10;
opacity: 100%;
width: 200px;
}
The redphone.png represents the specific image mentioned in the requirements.
It seems that using position: absolute; combined with z-index: 10; is the only method to achieve the desired result of having the .png image appear on top of the other while staying within the same div. Using position: relative; with the same z-index causes the png to be displaced outside the div.
You can view the full source code of the webpage by visiting this link.