Items can be aligned all at once horizontally using the justify-items property on the grid container.
Final Code
<style>.item1{background:LightSkyBlue;}.item2{background:LightSalmon;}.item3{background:PaleTurquoise;}.item4{background:LightPink;}.item5{background:PaleGreen;}.container{font-size:40px;min-height:300px;width:100%;background:LightGray;display:grid;grid-template-columns:1fr1fr1fr;grid-template-rows:1fr1fr1fr;grid-gap:10px;/* Only change code below this line */justify-items:center;/* Only change code above this line */}</style><divclass="container"><divclass="item1">1</div><divclass="item2">2</div><divclass="item3">3</div><divclass="item4">4</div><divclass="item5">5</div></div>