My square-shaped image (1:1 aspect ratio) is displaying differently across various devices when I use the codes below. While some show it as a perfect square, others display it as a rectangle. Is there a solution to maintain the original aspect ratio consistently?
<div class="col-xl-3"> <img src="images/myimg.jpg" style="width: auto; height: 310px; margin-top: -190px; padding-left: 50px;"
class="img-fluid" alt="Placeholder image"> </div>
<div class="col-xl-3"> <img src="images/myimg.jpg" style="width: 310px; height: 310px; margin-top: -190px; padding-left: 50px;"
class="img-fluid" alt="Placeholder image"> </div>
.img-fluid { max-width: 100%, height: auto }
This issue occurs on my static website hosted on Github pages. Any suggestions on how to ensure the image retains its original aspect ratio regardless of the device?
Feel free to experiment with different approaches. The goal is to keep the image's original form intact.