I am facing a perplexing issue with my code. It seems that simply using height: auto;
is causing the image to disappear, so I have resorted to manually setting the height to a specific number like 700px. You can refer to this JSFiddle for more details.
Is there a way to maintain the width and height of the image in portrait view on mobile devices?
Here is the HTML code:
<div style="background-image: url("https://mario.nintendo.com/static/fd723b2893d4d2b39ef71bfdb4e3329c/579b4/mario-background.png");" class="cpi-wall-detailed-image"></div>
And here is the CSS code:
.cpi-wall-detailed-image {
width: 100%;
height: 768px;
}