I am trying to create a responsive grid. Desktop should be one row with three images all centered. On smaller screens (<720px) I need two images, and the third image to wrap down onto the next line. I've achieved that - but it wraps onto the next line on the left - I need it CENTERED. I assume this is because the way I achieve the 'wrap' was by telling it to create two columns (so it's 'reserved' space for row 2/column 2).
At the moment it looks like this:
I want it to look like this:
@media (min-width: 900px) {
#grid-container-clients {
padding-top: 30px;
margin: auto;
display: grid;
width: 900px;
height: 200px;
grid-gap: 1rem;
grid-template-columns: 1fr 1fr 1fr;
background-color: white;
text-align: center;
}
.grid-item-clients {
/*grid-rows:*/
position: relative;
text-align: center;
border: solid black 1px;
border-radius: 2px;
}
}
@media (max-width: 899px) {
#grid-container-clients {
padding-top: 30px;
margin: auto;
display: grid;
width: 400px;
height: 400px;
grid-gap: 1rem;
grid-template-columns: 1fr 1fr;
background-color: white;
text-align: center;
}
.grid-item-clients {
position: relative;
text-align: center;
border: solid black 1px;
border-radius: 2px;
}
}
<div id="grid-container-clients">
<div class="grid-item-clients"><img src="images/client.png" style="width:100%;"></div>
<div class="grid-item-clients"><img src="images/client.png" style="width:100%"></div>
<div class="grid-item-clients"><img src="images/client.png" style="width:100%"></div>
</div>
<!-- End "container-clients" -->