I have been trying to center a very simple CSS grid, but it doesn't seem to work out - I would like the grid elements to stay centered when the viewport becomes too small, but one of them is going to the next line (they are centered before and after).
Can anyone tell me what I am doing wrong?
.Listing {
list-style: none;
display: grid;
grid-gap: 10px;
padding: 10px 40px;
grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
padding-bottom: 30px;
background-color: #71F;
justify-content: center;
}
.Listing li {
background-color: #F7F;
border: solid 1px #dddddd;
height: 150px;
}
<div id="Text">
<ul class="Listing">
<li>
<div></div>
</li>
<li>
<div></div>
</li>
<li>
<div></div>
</li>
</ul>
</div>