When viewing in fullscreen, the margins are set to ensure the container fits entirely within the page. However, without the 200px margin in the .gallery class, the container would be too big to fit on the page without scrolling.
The problem arises when the screen width shrinks, as the margins remain the same and push the container out of view.
I have tried using @media queries to adjust the margins as the screen width changes. But at dimensions 367x667 (iPhone SE dimensions), the container is entirely pushed in. How can I modify this so that the container still displays at those dimensions?
@media only screen and (min-width: 400px) {
.gallery{
padding: 0px;
margin: 40px;
margin-top: 0px;
margin-bottom: 0px;
}
}
.gallery-dog-img {
max-height: 100%;
max-width: 100%;
cursor: pointer;
width: 75%;
height: 75%;
}
.gallery{
padding: 40px 40px;
margin: 200px;
margin-top: 0px;
margin-bottom: 0px;
}
<head>
<link href="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="26444949525552544756661308160814">[email protected]</a>/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
</head>
<section class="gallery bg-primary">
<div class="container-sm dog-gallery-container">
<div class="row align-items-center g-0 dog-images-row row-cols-1 row-cols-sm-2 row-cols-md-3">
<div class="col d-flex justify-content-center dog-cell">
<img class= "gallery-dog-img rounded-3" src="https://source.unsplash.com/collection/190728/1500x900" alt="">
</div>
<div class="col d-flex justify-content-center dog-cell">
<img class= "gallery-dog-img rounded-3" src="https://source.unsplash.com/collection/190728/1500x900" alt="">
</div>
<div class="col d-flex justify-content-center dog-cell">
<img class= "gallery-dog-img rounded-3" src="https://source.unsplash.com/collection/190728/1500x900" alt="">
</div>
<div class="col d-flex justify-content-center dog-cell">
<img class= "gallery-dog-img rounded-3" src="https://source.unsplash.com/collection/190728/1500x900" alt="">
</div>
<div class="col d-flex justify-content-center dog-cell">
<img class= "gallery-dog-img rounded-3" src="https://source.unsplash.com/collection/190728/1500x900" alt="">
</div>
<div class="col d-flex justify-content-center dog-cell">
<img class= "gallery-dog-img rounded-3" src="https://source.unsplash.com/collection/190728/1500x900" alt="">
</div>
<div class="col d-flex justify-content-center dog-cell">
<img class= "gallery-dog-img rounded-3" src="https://source.unsplash.com/collection/190728/1500x900" alt="">
</div>
</div>
</div>
</section>