There seems to be too much space between the grid rows. I tried adding more photos or adjusting the height of the .image
class to 100%, but then the image gets stretched out.
The gap between items with classes .description
and #gallery
is too wide.
When I set the gallery height to 100%, it solves some issues, but unfortunately, it makes the gap between the grid rows even larger:
main {
display: flex;
text-align: center;
margin: 0px 10px 0px;
height: 100%;
flex-wrap: wrap;
flex: 1;
overflow-y: auto;
padding: 0px 5px;
margin: 0px;
}
#gallery {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(50rem, 1fr));
column-gap: 10px;
row-gap: 10px;
margin: 0px 30px;
top: 0px;
align-items: stretch;
}
.image {
display: block;
width: 100%;
object-fit: cover;
margin: 0px;
}
.description {
font-size: 1.8rem;
padding-top: 0px;
}
<main>
<p class="description"> text</p>
<div id="gallery">
<a href="01.jpg"><img class="image" src="https://placekitten.com/408/287" alt=""></a>
<a href="01.jpg"><img class="image" src="https://placekitten.com/408/287" alt=""></a>
<a href="01.jpg"><img class="image" src="https://placekitten.com/408/287" alt=""></a>
<a href="01.jpg"><img class="image" src="https://placekitten.com/408/287" alt=""></a>
</div>
</main>