I'm making a logo soup/quilt thinking of some solution to make it easy. So I make a 3x3 grid and add aspect-ratio: 2 / 1
to the grid elements. Now I want the img
s inside to expand so they either fit the max height or max width. Somehow the whole grid either expands past the scroll bar or the aspect ratio is set, but the images do not expand.
.grid-customers {
display: grid;
grid-template-columns: repeat(3, 1fr);
grid-template-rows: repeat(3, 1fr);
grid-column-gap: 50px;
grid-row-gap: 30px;
place-items: center;
}
.customer {
aspect-ratio: 2 / 1;
}
.customer a img {
max-width: 100%;
height: auto;
}
<div class="grid-customers">
<div class="customer customer-1">
<a href="https://example.org/">
<img src="media/logos/logo.png"/>
</a>
</div>
<div class="customer customer-1">
<a href="https://example.org/">
<img src="media/logos/logo.png"/>
</a>
</div>
<div class="customer customer-1">
<a href="https://example.org/">
<img src="media/logos/logo.png"/>
</a>
</div>
<div class="customer customer-1">
<a href="https://example.org/">
<img src="media/logos/logo.png"/>
</a>
</div>
<div class="customer customer-1">
<a href="https://example.org/">
<img src="media/logos/logo.png"/>
</a>
</div>
<div class="customer customer-1">
<a href="https://example.org/">
<img src="media/logos/logo.png"/>
</a>
</div>
<div class="customer customer-1">
<a href="https://example.org/">
<img src="media/logos/logo.png"/>
</a>
</div>
<div class="customer customer-1">
<a href="https://example.org/">
<img src="media/logos/logo.png"/>
</a>
</div>
<div class="customer customer-1">
<a href="https://example.org/">
<img src="media/logos/logo.png"/>
</a>
</div>
</div>