Some time ago I encountered the following
code:
HTML:
<div align="center">
</div>
CSS:
div{
background-image: image here;
background-position: center;
background-size: 100% auto;
max-width: 1920px;
}
Recently, I found myself sleepily typing this same code at night without any errors. However, upon saving and refreshing the site, the div failed to display in the center after zooming out. Strange, right?
I decided to remove the max width property and adjust the background-size to a fixed value of 1920px for the first parameter, which surprisingly resolved the issue. Ideally, I am looking for a solution where the div can adjust its size dynamically but never exceed 1920px
while remaining centered. Any suggestions on how to achieve this?