I tried to google it but most of the stuff people just say "use position absolute for the inner elements and it will fix it" but I do not want to do that since I want margins for my boxes in the container.
This is the code:
HTML:
<div class = "main_container">
<div class = "container">
<div class = "box"></div>
<div class = "box"></div>
<div class = "box"></div>
<div class = "box"></div>
</div>
</div>
CSS:
.main_container{
position: relative;
top: 49px;
background-color: orange;
height : 1446px;
width: 1496px;
margin: auto;
z-index: 5;
}
.container{
position: relative; /* I tried using position absolute too, but it didnt work */
background-color: white;
top: 0;
right: 200px;
width: 1098.8px;
min-width: 1098.8px;
max-width: 1098.8px;
height: 1041px;
margin: 0 auto;
}
.box{
position: relative; /
top: 50px;
border: solid;
border-color: grey;
width: 208px;
height: 335px;
margin-right: 2px;
margin-bottom: 3px;
display: inline-block;
}
How should I fix this? The boxes shift whenever I zoom in or out? I've literally spent the whole day trying to fix this situation, but no luck.